George John has Published 1167 Articles

What is the best IDE for C# on MacOS?

George John

George John

Updated on 20-Jun-2020 17:20:26

735 Views

On Windows, the best IDE to run C# programs is Visual Studio. On MacOS, the best IDE can be considered as Monodevelop.Monodevelop is an open source IDE that allows you to run C# on multiple platforms i.e. Windows, Linux and MacOS. Monodevelop is also known as Xamarin Studio.Monodevelop has a ... Read More

How to use LINQ in C#?

George John

George John

Updated on 20-Jun-2020 17:11:39

481 Views

Language Integrated Query (LINQ) is a Microsoft .NET Framework component and the uniform query syntax in C#. It has a set of method names and extends the language with query expressions.For LINQ in C#, use −using System.Linq;Let us see an example. Here we have used the LINQ computational methods Count ... Read More

What are lambda expressions in C#?

George John

George John

Updated on 20-Jun-2020 16:47:32

180 Views

A lambda expression in C# describes a pattern. It has the token => in an expression context. This is read as “goes to” operator and used when a lambda expression is declared.The following is an example showing how to use lambda expressions in C# −Example Live Demousing System; using System.Collections.Generic; ... Read More

Way to read input from console in C#

George John

George John

Updated on 20-Jun-2020 16:45:59

16K+ Views

Use the ReadLine() method to read input from the console in C#. This method receives the input as string, therefore you need to convert it.For example −Let us see how to get user input from user and convert it to integer.Firstly, read user input −string val; Console.Write("Enter integer: "); val ... Read More

What are generic delegates in C#?

George John

George John

Updated on 20-Jun-2020 16:41:07

710 Views

Using generic delegates, you do not need to define the delegate statement. They are defined in the System namespace.You can define a generic delegate with type parameters. For example −delegate T myDelegete(T n);ExampleThe following is an example showing how to create generic delegates in C# −using System; using System.Collections.Generic; ... Read More

What are dynamic data types in C#?

George John

George John

Updated on 20-Jun-2020 16:35:50

449 Views

Store any type of value in the dynamic data type variable. Type checking for these types of variables takes place at run-time.The following is the syntax for declaring a dynamic type −dynamic = value;The following is an example −dynamic val1 = 100; dynamic val2 = 5; dynamic val3 = ... Read More

What is the use of ‘Using’ statement in C#?

George John

George John

Updated on 20-Jun-2020 16:29:25

4K+ Views

The using statement is used to set one or more than one resource. These resources are executed and the resource is released. The statement is also used with database operations.The main goal is to manage resources and release all the resources automatically.Let us see an example wherein “A” would print ... Read More

How to use ReadKey() method of Console class in C#?

George John

George John

Updated on 20-Jun-2020 16:19:06

1K+ Views

Console.ReadKey(); is for the VS.NET Users. This makes the program wait for a key press and it prevents the screen from running and closing quickly when the program is launched from Visual Studio .NET.A common use of the ReadKey() method is that you can halt the program execution. This could ... Read More

HashSet in C#

George John

George John

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

590 Views

HashSet in C# eliminates duplicate strings or elements in an array.In C#, it is an optimized set collection.Let us see an example to remove duplicate strings using C# HashSet. Here, we have duplicate elements −Example Live Demousing System; using System.Collections.Generic; using System.Linq; class Program {    static void Main() { ... Read More

How to capture index out of range exception in C#?

George John

George John

Updated on 20-Jun-2020 16:07:25

1K+ Views

IndexOutOfRangeException occurs when you try to access an element with an index that is outsise the bounds of the array.Let’s say the following is our array. It has 5 elements −int [] n = new int[5] {66, 33, 56, 23, 81};Now if you will try to access elements with index ... Read More

Advertisements