Karthikeya Boyini has Published 2383 Articles

C# Console BufferWidth Property

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 08:21:16

122 Views

Use the BufferWidth gets or sets the width of the buffer area.Use the property like this −Console.BufferWidthLet us see the complete example.Example Live Demousing System; class Demo {    static void Main() {       Console.WriteLine("Buffer width (columns) = "+Console.BufferWidth);    } }OutputBuffer width (columns) = 0

C# Linq Intersect Method

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 08:18:12

438 Views

Find common elements between two arrays using the Intersect() method.The following are our arrays −int[] val1 = { 15, 20, 40, 60, 75, 90 }; int[] val2 = { 17, 25, 35, 55, 75, 90 };To perform intersection.val1.AsQueryable().Intersect(val2);Let us see the entire example.Example Live Demousing System; using System.Collections.Generic; using System.Linq; class ... Read More

C# Queryable Max Method

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 08:15:18

133 Views

Get the maximum value from a sequence using the Max() method.Let’s say the following is our list.List list = new List { 200, 400, 600, 800, 1000, 1200, 1400, 1600, 1800, 2000 };Use the Max() method to get the largest element.list.AsQueryable().Max();Example Live Demousing System; using System.Collections.Generic; using System.Linq; class Demo { ... Read More

C# Program to find a key in a Hashtable

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 08:13:17

415 Views

Set Hashtable collection with elements.Hashtable h = new Hashtable(); h.Add(1, "Jack"); h.Add(2, "Henry"); h.Add(3, "Ben"); h.Add(4, "Chris");Let’s say now you need to find any key, then use the Contains() method. We are finding key 3 here −h.Contains(3);The following is the complete example.Example Live Demousing System; using System.Collections; public class Demo { ... Read More

ContainsKey() method in C#

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 08:11:40

248 Views

Set a Hashtable collection and add some elements to it.Hashtable h = new Hashtable(); h.Add(1, "Sam"); h.Add(2, "Jack"); h.Add(3, "Andy"); h.Add(4, "Katie"); h.Add(5, "Beth"); h.Add(6, "Benjamin");Use the ContainsKey() method to check whether a key exists in a Hashtable or not.Let’s check for key 3. It returns True of the key ... Read More

C# Program to get distinct element from a sequence

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 08:08:25

231 Views

Set a sequence and add elements.List ID = new List { 120, 111, 250, 111, 120, 300, 399, 450 };Use Distinct() method to get distinct element from the above list.IEnumerable res = ID.AsQueryable().Distinct();Let us see the complete code.Example Live Demousing System; using System.Linq; using System.Collections.Generic; class Demo {    static void ... Read More

C# Enum ToString() Method

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 08:06:27

2K+ Views

The ToString() method converts the value of this instance to its equivalent string representation.Firstly, set an enum.enum Vehicle { Car, Bus, Truck, Motobike };To convert it to an equivalent string representation, use ToString().Vehicle.Car.ToString("d")Example Live Demousing System; public class Demo {    enum Vehicle { Car, Bus, Truck, Motobike };    public ... Read More

What is the role of Browser Object Model (BOM) in JavaScript?

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 08:04:18

2K+ Views

The Browser Object Model (BOM) in JavaScript includes the properties and methods for JavaScript to interact with the web browser.BOM provides you with a window objects, for example, to show the width and height of the window. It also includes the window.screen object to show the width and height of ... Read More

What is availHeight property in JavaScript?

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 08:03:15

59 Views

Use the screen.availHeight property to return the width of the user’s screen. The result will be in pixels and Taskbar feature won’t be included.ExampleYou can try to run the following code to learn how to work with the screen.availHeight property in JavaScript −Live Demo           ... Read More

Long Date ("D") Format Specifier in C#

karthikeya Boyini

karthikeya Boyini

Updated on 23-Jun-2020 07:59:35

254 Views

The "D" format specifier represents a custom date and time format string.The format string is defined by culture's DateTimeFormatInfo.LongDatePattern property.The custom format string is −dddd, dd MMMM yyyyExample Live Demousing System; using System.Globalization; class Demo {    static void Main() {       DateTime myDate = new DateTime(2018, 9, 20); ... Read More

Advertisements