Karthikeya Boyini has Published 2383 Articles

What is the difference between declaration and definition in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 22-Jun-2020 07:37:03

11K+ Views

Declaration means that variable is only declared and memory is allocated, but no value is set.However, definition means the variables has been initialized.The same works for variables, arrays, collections, etc.VariablesDeclaring a variable.int x;Let’s define and assign a value.x = 10; ArraysDeclaring an array.int [] n // declaring int n= new ... Read More

Important Keywords in C#

karthikeya Boyini

karthikeya Boyini

Updated on 22-Jun-2020 07:34:54

239 Views

Some of the key keywords in C#, include.SealedParamsInternalthisabstractSealedWhen 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.ParamsWhile declaring a method, you are not sure ... Read More

What is the System.Console class and its methods in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 22-Jun-2020 07:29:16

589 Views

The System.Console class in C# represents the standard input, output, and error streams for console applications.The following are some of the methods of the System.Console class −Refer: MSDN System Class methodsSr.NoMethod & Description1Beep()Plays the sound of a beep through the console speaker.2Beep(Int32, Int32)Plays the sound of a beep of a ... Read More

Random Numbers in C#

karthikeya Boyini

karthikeya Boyini

Updated on 22-Jun-2020 07:27:06

18K+ Views

To generate random numbers in C#, use the Next(minValue, MaxValue) method. The parameters are used to set the minimum and maximum values.Next(100, 200);We have set the above method under Random() object.Random rd = new Random(); int rand_num = rd.Next(100, 200);The following is an example −Example Live Demousing System; class Program { ... Read More

How to generate the first 100 even Numbers using C#?

karthikeya Boyini

karthikeya Boyini

Updated on 22-Jun-2020 07:24:40

2K+ Views

To generate first 100 even numbers, set a for loop from 1 to 100.for(val = 1; val

What is method hiding in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 22-Jun-2020 07:22:06

1K+ Views

Method hiding is also known as shadowing. The method of the parent class is available to the child class without using the override keyword in shadowing. The child class has its own version of the same function.Use the new keyword to perform shadowing.Let us see an example.Example Live Demousing System; using ... Read More

What is the difference between a mutable and immutable string in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 22-Jun-2020 07:18:45

3K+ Views

Mutable stringStringBuilder is a mutable string in C#. With StringBuilder, you can expand the number of characters in the string. The string cannot be changed once it is created, but StringBuilder can be expanded. It does not create a new object in the memory.Set StringBuilder −StringBuilder str = new StringBuilder();Let ... Read More

What is the difference between = and: = assignment operators?

karthikeya Boyini

karthikeya Boyini

Updated on 22-Jun-2020 06:58:55

644 Views

Actually, they both are assignment operator and used to assign values but the significant difference between them is as follows −= operator assigns a value either as a part of the SET statement or as a part of the SET clause in an UPDATE statement, in any other case = ... Read More

How can we use MySQL SUM() function with HAVING clause?

karthikeya Boyini

karthikeya Boyini

Updated on 22-Jun-2020 05:06:51

2K+ Views

By using MySQL SUM() function with the HAVING clause, it filters the result based on a specific condition given after the HAVING clause. To understand the above concept, consider an ‘employee_tbl’ table, which is having the following records −mysql> SELECT * FROM employee_tbl; +------+------+------------+--------------------+ | id   | name | ... Read More

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

karthikeya Boyini

karthikeya Boyini

Updated on 21-Jun-2020 16:54:30

1K+ Views

An interface is a class without fields or method implementation. It cannot implement the methods it defines.A class generally implements the methods defined in an interface.InterfaceInterfaces define properties, methods, and events, which are the members of the interface. Interfaces contain only the declaration of the members. It is the responsibility ... Read More

Advertisements