Ankith Reddy has Published 996 Articles

How to add items/elements to an existing jagged array in C#?

Ankith Reddy

Ankith Reddy

Updated on 21-Jun-2020 14:50:24

899 Views

To add an element to existing jagged array, just set the value of the element with a new value.Let’s say you need to add an element at the following location −a[3][1]Just set the value −a[3][1] = 500;Above, we accessed the first element of the 3rd array in a jagged array.Let ... Read More

Value Type vs Reference Type in C#

Ankith Reddy

Ankith Reddy

Updated on 21-Jun-2020 14:01:19

7K+ Views

Value Type and Reference, both are types in C# −Value TypeValue type variables can be assigned a value directly. They are derived from the class System.ValueType. The value types directly contain data. When you declare an int type, the system allocates memory to store the value.Value Type variables are stored ... Read More

How to compare two lists and add the difference to a third list in C#?

Ankith Reddy

Ankith Reddy

Updated on 21-Jun-2020 13:47:41

1K+ Views

First, set the two lists −List OneList < string > list1 = new List < string > (); list1.Add("A"); list1.Add("B"); list1.Add("C"); list1.Add("D");List TwoList < string > list2 = new List < string > (); list2.Add("C"); list2.Add("D");To find the difference between the two list and display the difference elements −IEnumerable < ... Read More

How to access elements from an array in C#?

Ankith Reddy

Ankith Reddy

Updated on 21-Jun-2020 13:09:21

892 Views

First, define and initalize an array −int[] p = new int[3] {99, 92, 95};Now, display the array elements −for (j = 0; j < 3; j++ ) {    Console.WriteLine("Price of Product[{0}] = {1}", j, p[j]); }To acess any element, just include the index of the element you want like ... Read More

C# object serialization

Ankith Reddy

Ankith Reddy

Updated on 21-Jun-2020 12:59:50

251 Views

For object serialization, you need to refer the below code. Here, we have use the BinaryFormatter.Serialize (stream, reference) method to serialize our sample object.We have set a constructor here −public Employee(int id, string name, int salary) {    this.id = id;    this.name = name;    this.salary = salary; }Now ... Read More

What are types in C#?

Ankith Reddy

Ankith Reddy

Updated on 21-Jun-2020 12:36:45

189 Views

The types in C# include the following −Value TypesValue type variables can be assigned a value directly. They are derived from the class System.ValueType.The value types directly contain data. Some examples are int, char, and float, which stores numbers, alphabets, and floating point numbers, respectively. When you declare an int ... Read More

What are sealed modifiers in C#?

Ankith Reddy

Ankith Reddy

Updated on 21-Jun-2020 11:57:56

477 Views

When you use sealed modifiers in C# on a method, then the method loses its capabilities of overriding. The sealed method should be part of a derived class and the method must be an overridden method.Let us see an example −The following example won’t allow you to override the method ... Read More

Transform the element using x-axis with CSS3

Ankith Reddy

Ankith Reddy

Updated on 21-Jun-2020 08:33:31

143 Views

Use the translateX(x) method to transform the element using x-axis.Let us see the syntaxtranslateX(x)Here,x: It is a length representing the abscissa of the translating vector.Let us see an examplediv {    width: 40px;    height: 40px;    background-color: black; } .trans {    transform: translateX(20px);    background-color: orange; }

What is a generic List in C#?

Ankith Reddy

Ankith Reddy

Updated on 20-Jun-2020 17:33:53

3K+ Views

Generic List is a generic collection in C#. The size can be dynamically increased using List, unlike Arrays.Let us see an example −We have set the List first −List myList = new List()Now add elements in the list −List myList = new List() {    "mammals",    "reptiles",    "amphibians" ... Read More

Streams In C#

Ankith Reddy

Ankith Reddy

Updated on 20-Jun-2020 17:21:47

6K+ Views

The stream is basically the sequence of bytes passing through the communication path. There are two main streams: the input stream and the output stream. The input stream is used for reading data from file (read operation) and the output stream is used for writing into the file (write operation).The ... Read More

Advertisements