Samual Sam has Published 2492 Articles

What is finally statement in C#?

Samual Sam

Samual Sam

Updated on 20-Jun-2020 13:24:44

259 Views

The final block is used to execute a given set of statements, whether an exception is thrown or not thrown. For example, if you open a file, it must be closed whether an exception is raised or not.The error handling blocks are implemented using the try, catch, and finally keywords.ExampleYou ... Read More

What is overloading in C#?

Samual Sam

Samual Sam

Updated on 20-Jun-2020 13:22:01

2K+ Views

C# provides two techniques to implement static polymorphism −Function overloadingOperator overloadingFunction OverloadingTwo or more than two methods having the same name but different parameters is what we call function overloading in C#.Function overloading in C# can be performed by changing the number of arguments and the data type of the ... Read More

What are unary operators in C#?

Samual Sam

Samual Sam

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

249 Views

The following are the unary operators in C# −+ - ! ~ ++ -- (type)* & sizeofLet us learn about the sizeof operator. The sizeof returns the size of a data type.Let’s say you need to find the size of int datatype −sizeof(int)For double datatype −sizeof(double)Let us see the complete ... Read More

What are static members of a C# Class?

Samual Sam

Samual Sam

Updated on 20-Jun-2020 13:10:49

4K+ Views

We can define class members as static using the static keyword. When we declare a member of a class as static, it means no matter how many objects of the class are created, there is only one copy of the static member.The keyword static implies that only one instance of ... Read More

How can we use MySQL POWER() function with the column’s data values?

Samual Sam

Samual Sam

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

83 Views

If we want to use POWER() function with column’s data values then the first argument i.e. the base would be the name of the column and the second argument i.e. the exponent would be as specified by us. To understand it considers a table ‘Employee’ having the following records −mysql> ... Read More

What is the default access for a class in C#?

Samual Sam

Samual Sam

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

1K+ Views

If no access modifier is specified, then the default is Internal. Internal access specifier allows a class to expose its member variables and member functions to other functions and objects in the current assembly. In other words, any member with internal access specifier can be accessed from any class or ... Read More

What is the default constructor in C#?

Samual Sam

Samual Sam

Updated on 20-Jun-2020 12:46:36

166 Views

A class constructor is a special member function of a class that is executed whenever we create new objects of that class. A default constructor does not have any parameter.The following is an example showing how to work with default constructor in C# −Example Live Demousing System; namespace LineApplication { ... Read More

What are constructors in C# programs?

Samual Sam

Samual Sam

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

429 Views

A class constructor is a special member function of a class that is executed whenever we create new objects of that class.A constructor has exactly the same name as that of class and it does not have any return type.Constructor has the same name as the class name −class Demo ... Read More

How to use Null Coalescing Operator (??) in C#?

Samual Sam

Samual Sam

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

2K+ Views

The null coalescing operator is used with the nullable value types and reference types. It is used for converting an operand to the type of another nullable (or not) value type operand, where an implicit conversion is possible.If the value of the first operand is null, then the operator returns ... Read More

How to capture divide by zero exception in C#?

Samual Sam

Samual Sam

Updated on 20-Jun-2020 11:40:58

3K+ Views

System.DivideByZeroException is a class that handles errors generated from dividing a dividend with zero.ExampleLet us see an example −using System; namespace ErrorHandlingApplication {    class DivNumbers {       int result;       DivNumbers() {          result = 0;       } ... Read More

Advertisements