Karthikeya Boyini has Published 2193 Articles

What does Array.Rank property of array class do in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 12:50:42

301 Views

Let us see an example to find the number of dimensions of an array, using the Rank property.arr.RankHere, arr is our array −int[, ] arr = new int[5, 5];If you want to get the rows and columns the array has, then use the GetLength property −arr.GetLength(0); arr.GetLength(1);The following is the ... Read More

What are dynamic arrays in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 11:49:55

6K+ Views

Dynamic arrays are growable arrays and have an advantage over static arrays. This is because the size of an array is fixed.To create arrays dynamically in C#, use the ArrayList collection. It represents an ordered collection of an object that can be indexed individually. It also allows dynamic memory allocation, ... Read More

How to call a method of a class in C#

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 11:43:43

3K+ Views

To call a method, use the name of the method after the object name, for example, −obj1. Display();Let’s say the class name is ApplicationOne, so to call the method −ApplicationOne one = new ApplicationOne(); //calling the displayMax method ret = one.displayMax(a, b);The following is the example showing how to ... Read More

How to use an assignment operator in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 11:39:47

160 Views

Assign value to a variable using the assignment operator in C# −The following are the assignment operators in C# −OperatorDescriptionExample=Simple assignment operator, Assigns values from right side operands to left side operandC = A + B assigns value of A + B into C+=Add AND assignment operator, It adds right ... Read More

How to define multi-dimensional arrays in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 11:33:35

361 Views

C# allows multidimensional arrays. It includes an array with more than one dimension. Declare a 2-dimensional array of strings as −string [, ] names;A 2-dimensional array can be thought of as a table, which has x number of rows and y number of columns.Multidimensional arrays may be initialized by specifying ... Read More

What is the RemoveAt method in C# lists?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 11:20:30

5K+ Views

The RemoveAt() method in C# is used to remove an element in a list at a position you set.Firstly, set elements in the list −var subjects = new List(); subjects.Add("Physics"); subjects.Add("Chemistry"); subjects.Add("Biology"); subjects.Add("Science");To remove an element, set the index from where you want to eliminate the element. The following is ... Read More

How is an array declared in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 11:18:23

108 Views

To declare an array in C#, you can use the following syntax −datatype[ ] Name_of_array;Here, datatype is used to specify the type of elements in the array.[ ] specifies the size of the array.Name_of_array specifies the name of the array.The following is an example −double[ ] balance;Let us see an ... Read More

What is the maximum possible value of an integer in C# ?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 11:09:37

14K+ Views

The maximum possible value of an integer is 2, 147, 483, 647.The following are the datatypes of C# with the maximum and minimum value −TypeRepresentsRangeDefault ValueboolBoolean valueTrue or FalseFalsebyte8-bit unsigned integer0 to 255char16-bit Unicode characterU +0000 to U +ffff'\0'decimal128-bit precise decimal values with 28-29 significant digits(-7.9 x 1028 to 7.9 ... Read More

What is the Count property of BitArray class in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 11:05:29

133 Views

Count the number of elements in the BitArray class using the Count property.Let us first set our BitArray class −BitArray arr = new BitArray(10);Now use the Count property as shown below −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main() {   ... Read More

What is the Count property of Stack class in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 11:03:35

247 Views

To find how many elements are added in the Stack class, you need to use the Count property.Let us first add elements in the Stack −Stack st = new Stack(); st.Push('H'); st.Push('I'); st.Push('J'); st.Push('K'); st.Push('L'); st.Push('M'); st.Push('N'); st.Push('O');Now count the number of elements in the Stack −Console.WriteLine("Count: "+st.Count);Let us ... Read More

Advertisements