Karthikeya Boyini has Published 2383 Articles

Major features of C# programming

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 14:49:42

2K+ Views

C# is a modern, general-purpose, object-oriented programming language developed by Microsoft. C# is designed for Common Language Infrastructure (CLI), which consists of the executable code and runtime environment that allows the use of various high-level languages on different computer platforms and architectures.The following are the major features of C# −Following ... Read More

What are pointer data types in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 14:45:09

1K+ Views

A pointer is a variable whose value is the address of another variable i.e., the direct address of the memory location. Similar to any variable or constant, you must declare a pointer before you can use it to store any variable address.The syntax of a pointer is −type *var-name;The following ... Read More

Ternary Operator in C#

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 14:43:03

3K+ Views

Ternary operator is a Conditional operator in C#. It takes three arguments and evaluates a Boolean expression.For example −b = (a == 1) ? 20 : 30;Above, if the first operand evaluates to true (1), the second operand is evaluated. If the first operand evaluates to false (0), the third ... Read More

How to get int value from enum in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 14:41:32

152 Views

Firstly, set the enum −public enum Vehicle { Car, Bus, Truck }Now use typecasting to cast an enum to int −int a = (int)Vehicle.Car;The following is the complete code to cast an enum to int −Example Live Demousing System; public class Demo {    public enum Vehicle { Car, Bus, ... Read More

C# program to print all the common elements of two lists

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 14:37:48

2K+ Views

Firstly create the two lists −List list1 = new List() {40, 20, 60, 3, 55}; List list2 = new List() {20, 70, 55, 80};To find the common elements, use the Intersect −list1.Intersect(list2)The following is the complete code to find the common elements between the two lists −Example Live Demousing System; using ... Read More

C# program to print all sublists of a list

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 14:34:45

445 Views

Firstly, create a list −List list = new List();The string here is “xyz” for which we will find the sublists. While looping we will declare another list, that would generate sublists on every true iteration −for (int i = 1; i < str.Length; i++) {    list.Add(str[i - 1].ToString());   ... Read More

What is the use of sizeof Operator in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 14:20:00

347 Views

The sizeof() datatype 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 example to find the size of various datatypes −Example Live Demousing System; namespace Demo {    class Program { ... Read More

What is the use of ‘new’ keyword in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 14:16:55

701 Views

Use the new keyword to create an instance of the array −int [] a = new int[5];The new operator is used to create an object or instantiate an object. Here in the example, an object is created for the class using the new −Example Live Demousing System; namespace CalculatorApplication { ... Read More

How can we distinguish between MySQL IFNULL() and NULLIF() functions?

karthikeya Boyini

karthikeya Boyini

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

2K+ Views

Actually, both MySQL IFNULL() and NULLIF() functions are having an almost same syntax as given below −The syntax of IFNULL()IFNULL(expression1, expression2)The syntax of NULLIF()NULLIF(expression1, expression2)They can be distinguished in the way they return the first argument as result. IFNULL() function will return the first argument as a result if it is not ... Read More

What is enumeration in C#?

karthikeya Boyini

karthikeya Boyini

Updated on 20-Jun-2020 13:27:04

130 Views

Enum is Enumeration to store a set of named constants like a year, product, month, season, etc.The default value of Enum constants starts from 0 and increments. It has a fixed set of constants and can be traversed easily.Let us see an example.We have set the enum like this −public ... Read More

Advertisements