AmitDiwan has Published 10744 Articles

Convert the specified double-precision floating point number to a 64-bit signed integer in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:20:20

379 Views

To convert the specified double-precision floating point number to a 64-bit signed integer, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       double d = 5.646587687;       Console.Write("Value = "+d);       long res = ... Read More

Convert the value of the current DateTime object to a Windows file time in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:17:06

283 Views

To convert the value of the current DateTime object to a Windows file time, the code is as follows −Example Live Demousing System; public class Demo {    public static void Main() {       DateTime d = DateTime.Now;       Console.WriteLine("Date = {0}", d);       long ... Read More

How to use strings in switch statement in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:15:20

2K+ Views

A switch statement allows a variable to be tested for equality against a list of values. Each value is called a case, and the variable being switched on is checked for each switch case.ExampleHere is an example to use strings in a switch statement − Live Demousing System; public class Demo ... Read More

Get an enumerator that iterates through the StringDictionary in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:13:32

105 Views

To get an enumerator that iterates through StringDictionary, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Specialized; public class Demo {    public static void Main() {       StringDictionary strDict1 = new StringDictionary();       strDict1.Add("A", "John");       strDict1.Add("B", "Andy");     ... Read More

foreach Loop in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:11:40

530 Views

The foreach loop executes a statement or a block of statements for each element in an instance of the type that implements the System.Collections.IEnumerable or System.Collections.Generic.IEnumerable interface.ExampleLet us see an example of foreach loop − Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main(){     ... Read More

Get an enumerator that iterates through the SortedSet in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:10:21

107 Views

To get an enumerator that iterates through the SortedSet, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main() {       SortedSet set1 = new SortedSet();       set1.Add("AB");       set1.Add("BC");       set1.Add("CD");   ... Read More

How to create a shallow copy of ArrayList in C#?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:09:00

235 Views

To create a shallow copy of ArrayList in C#, the code is as follows −Example Live Demousing System; using System.Collections; public class Demo {    public static void Main(){       ArrayList list = new ArrayList();       list.Add("One");       list.Add("Two");       list.Add("Three");     ... Read More

Check if every List element matches the predicate conditions in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:06:51

363 Views

To check if every List element matches the predicate conditions, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    private static bool demo(int i) {       return ((i % 10) == 0);    }    public static void Main(String[] args) {   ... Read More

How to create a ListDictionary in C#?

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:05:05

101 Views

To create a ListDictionary, the code is as follows −Example Live Demousing System; using System.Collections; using System.Collections.Specialized; public class Demo {    public static void Main(){       ListDictionary dict = new ListDictionary();       dict.Add("1", "SUV");       dict.Add("2", "Sedan");       dict.Add("3", "Utility Vehicle");   ... Read More

Intersection of two HashSets in C#

AmitDiwan

AmitDiwan

Updated on 11-Dec-2019 07:02:09

515 Views

To find the intersection of two HashSets, the code is as follows −Example Live Demousing System; using System.Collections.Generic; public class Demo {    public static void Main(){       HashSet set1 = new HashSet();       set1.Add("AB");       set1.Add("CD");       set1.Add("EF");       set1.Add("AB"); ... Read More

Advertisements