Karthikeya Boyini has Published 2383 Articles

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

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 13:23:19

80 Views

The Array.IsReadOnly property gets a value indicating whether the Array is read-only.Firstly, set the array values −Array arr = Array.CreateInstance(typeof(String), 3); arr.SetValue("Electronics", 0); arr.SetValue("Clothing", 1);Now let’s use the IsReadOnly property to find whether the Array is read-only. If the array is read-only, then it cannot be updated −arr.IsReadOnlyThe following is ... Read More

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

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 13:20:50

124 Views

The Array.LongLength property gets a 64-bit integer that represents the total number of elements in all the dimensions of the Array.Let’s say your array of long data type is −long[, ] arr1= new long[15, 35];Use the LongLength property to get an integer representing the total number of elements in all ... Read More

What is dynamic binding in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 13:18:34

407 Views

In Dynamic binding, the compiler will not do type checking at compile time. At runtime, the checking is done.Use it to avoid the restriction of anonymous types to one method. This is only because the type name is visible only to the compiler; therefore, you cannot declare it as the ... Read More

What are user-defined exceptions in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 13:16:08

529 Views

Like any other programming language, in C#, you can easily create a user-defined exception. User-defined exception classes are derived from the Exception class. Custom exceptions are what we call user-defined exceptions.In the below example, the exception created is not a built-in exception; it is a custom exception −TempIsZeroExceptionYou can try ... Read More

What are nested classes in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 13:11:19

190 Views

A nested class is a class declared in another enclosing class. It is a member of its enclosing class and the members of an enclosing class have no access to members of a nested class.Let us see an example code snippet of nested classes in C# −class One {   ... Read More

What are static member functions in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 13:09:32

498 Views

Static functions can access only static variables. The static functions exist even before the object is created.Set static functions as −public static int getNum() {}The following is an example demonstrating the use of static functions −Example Live Demousing System; namespace Demo {    class StaticVar {       public ... Read More

How can I use IFNULL() function at the place of COALESCE() function in MySQL?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 13:00:17

2K+ Views

As we know that IFNULL() function will return the first argument if it is not NULL otherwise it returns the second argument. On the other hand, COALESCE() function will return first non-NULL argument. Actually, both IFNULL() and COALESCE() functions in MySQL works equivalently if the number of arguments is two ... Read More

What is the difference between a class and an object in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 12:58:55

234 Views

When you define a class, you define a blueprint for a data type.Objects are instances of a class. The methods and variables that constitute a class are called members of the class.To access the class members, you use the dot (.) operator after the object name. The dot operator links ... Read More

What are the differences between ref and out parameters in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 12:54:41

430 Views

Ref ParameterA reference parameter is a reference to a memory location of a variable. When you pass parameters by reference, unlike value parameters, a new storage location is not created for these parameters.You can declare the reference parameters using the ref keyword. The following is an example −Example Live Demousing System; ... Read More

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

karthikeya Boyini

karthikeya Boyini

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

198 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

Advertisements