Samual Sam has Published 2310 Articles

How to calculate the power exponent value using C#?

Samual Sam

Samual Sam

Updated on 20-Jun-2020 14:18:25

1K+ Views

To calculate the power exponent value, use the Math.pow() method.Here, n is the number and p is the power −double res = Math.Pow(n, p);The following is the complete code −Example Live Demousing System; class Program {    static void Main() {       double n, p;       n ... Read More

What is the Values property of SortedList class in C#?

Samual Sam

Samual Sam

Updated on 20-Jun-2020 14:15:10

92 Views

Firstly, declare the SortedList class −SortedList list = new SortedList();Now add the values −list.Add("S1", "Wallets"); list.Add("S2", "Sunglasses"); list.Add("S3", "Backpacks");The following is the code to work with Values property of SortedList class −Example Live Demousing System; using System.Collections; namespace Demo {    class Program {       static void Main(string[] ... Read More

What is finally statement in C#?

Samual Sam

Samual Sam

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

372 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

3K+ 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

440 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

5K+ 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

144 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

268 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

604 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

Advertisements