Karthikeya Boyini has Published 2383 Articles

Serialization and Deserialization in C#

karthikeya Boyini

karthikeya Boyini

Updated on 21-Jun-2020 15:54:49

1K+ Views

Serialization converts objects into a byte stream and brings it to a form that it can be written on stream. This is done to save it to memory, file or database.Serialization can be performed as −Binary SerializationAll the members, even members that are read-only, are serializedXML SerializationIt serializes the public ... Read More

Final keyword in C#

karthikeya Boyini

karthikeya Boyini

Updated on 21-Jun-2020 15:48:12

3K+ Views

Java has a final keyword, but C# does not have its implementation. For the same implementation, use the sealed keyword.With sealed, you can prevent overriding of a method. When you use sealed modifiers in C# on a method, then the method loses its capabilities of overriding. The sealed method should ... Read More

How to use Remove, RemoveAt, RemoveRange methods in C# list collections?

karthikeya Boyini

karthikeya Boyini

Updated on 21-Jun-2020 15:45:41

730 Views

To implement Remove() and RemoveAt() methods in C#, try the following code −Firstly, set a list.List myList = new List() {    "mammals",    "reptiles",    "amphibians",    "vertebrate" };Now, use Remove() method to remove an element.myList.Remove("reptiles");Now, use RemoveAt() method to remove an element by setting the position.myList.RemoveAt(2);The following is ... Read More

What are the differences between a dictionary and an array in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 21-Jun-2020 15:36:19

551 Views

DictionaryDictionary is a collection of keys and values in C#. Dictionary is included in the System.Collection.Generics namespace.To declare a Dictionary −IDictionary d = new Dictionary();To add elements −IDictionary d = new Dictionary(); d.Add(1, 97); d.Add(2, 89); d.Add(3, 77); d.Add(4, 88);ArrayArray stores a fixed-size sequential collection of elements of the same ... Read More

Decimal to Multiple-Bases Conversion with Stack

karthikeya Boyini

karthikeya Boyini

Updated on 21-Jun-2020 15:33:36

384 Views

For multiple-base conversions, set a variable and add the base you want to calculate.Here, for our example, I have set the variable baseNum as 2 −int baseNum = 2;In the same way, if you want base 8, then set the above as −int baseNum = 2; You can also get ... Read More

Why do we use internal keyword in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 21-Jun-2020 15:28:22

2K+ Views

Internal keyword allows you to set internal access specifier.Internal access specifier allows a class to expose its member variables and member functions to other functions and objects in the current assembly.Any member with internal access specifier can be accessed from any class or method defined within the application in which ... Read More

How to copy a List collection to an array?

karthikeya Boyini

karthikeya Boyini

Updated on 21-Jun-2020 15:16:52

596 Views

To copy a C# list collection to an array, firstly set a list −List list1 = new List (); list1.Add("One"); list1.Add("Two"); list1.Add("Three"); list1.Add("Four");Now declare a string array and use the CopyTo() method to copy −string[] arr = new string[20]; list1.CopyTo(arr);Let us see the complete code to copy a ... Read More

What is C# Programming?

karthikeya Boyini

karthikeya Boyini

Updated on 21-Jun-2020 15:04:37

167 Views

C# is a modern, general-purpose, object-oriented programming language developed by Microsoft.C# is designed for Common Language Infrastructure (CLI), which consists of the executable code and runtime environment that allows the use of various high-level languages on different computer platforms and architectures.Here are the features of C# −Boolean ConditionsAutomatic Garbage CollectionStandard ... Read More

What is index-based I/O ArrayList collection in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 21-Jun-2020 14:59:39

303 Views

ArrayList class represents an ordered collection of an object that can be indexed individually. It is an alternative to an array.The following table lists some of the commonly used properties of the ArrayList class −Sr.NoProperty & Description1CapacityGets or sets the number of elements that the ArrayList can contain.2CountGets the number ... Read More

How to add string values to a C# list?

karthikeya Boyini

karthikeya Boyini

Updated on 21-Jun-2020 14:51:06

14K+ Views

To add string values to a list in C#, use the Add() method.Firstly, declare a string list in C# −List list1 = new List();Now add string items −myList.Add("Jack"); myList.Add("Ben"); myList.Add("Eon"); myList.Add("Tim");Let us see the complete code −Exampleusing System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Demo {    public ... Read More

Advertisements