Chandu yadav has Published 1091 Articles

Implicit conversion from 8-bit signed integer (SByte) to Decimal in C#

Chandu yadav

Chandu yadav

Updated on 23-Jun-2020 07:50:23

260 Views

SByte represents an 8-bit signed integer.To implicitly convert an 8-bit signed integer to a Decimal, firstly set an sbyte value.sbyte val = 51;To convert sbyte to decimal, assign the value.decimal d; d = val;Let us see another example.Exampleusing System; public class Demo {    public static void Main() {   ... Read More

LinkedList AddAfter method in C#

Chandu yadav

Chandu yadav

Updated on 23-Jun-2020 07:48:28

1K+ Views

Set a LinkedList.int [] num = {1, 2, 3, 4, 5}; LinkedList list = new LinkedList(num);Now add a node at the end using AddLast() method.var newNode = list.AddLast(20);To add a node after the above added node, use the AddAfter() method.list.AddAfter(newNode, 30);Example Live Demousing System; using System.Collections.Generic; class Demo {    static ... Read More

C# Program to return a collection with repeated elements

Chandu yadav

Chandu yadav

Updated on 23-Jun-2020 07:44:12

338 Views

To return a collection with repeated elements in C#, use Enumerable.Repeat method.It is part of System.Linq namespace.Let’s say you need to repeat a number twice, for that set the number and the frequency of repetition.Enumerable.Repeat(50, 2);Now assign it to a variable and display it.Example Live Demousing System; using System.Linq; class Demo ... Read More

C# Console BufferHeight Property

Chandu yadav

Chandu yadav

Updated on 23-Jun-2020 07:38:38

143 Views

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

Convert.ToChar Method in C#

Chandu yadav

Chandu yadav

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

1K+ Views

The Convert.ToChar method is used to convert a specified value to a Unicode integer.We have declared an sbyte variable.sbyte byteVal = 200;Now, use the Convert.ToChar() method to convert the sbyte value to a Unicode integer.charVal = Convert.ToChar(b);Let us see another example.Example Live Demousing System; public class Demo {    public static ... Read More

C# DateTime Max Value

Chandu yadav

Chandu yadav

Updated on 23-Jun-2020 07:29:21

6K+ Views

To set the max value for a Date, use the DateTime property MaxValue.DateTime max = DateTime.MaxValue;Now, display the value of max to get the maximum value of a date as shown below.Example Live Demousing System; using System.Linq; public class Demo {    public static void Main() {       DateTime ... Read More

C# Program to add a node after the given node in a Linked List

Chandu yadav

Chandu yadav

Updated on 23-Jun-2020 07:24:57

299 Views

Set a LinkedList and add elements.string [] students = {"Beth", "Jennifer", "Amy", "Vera"}; LinkedList list = new LinkedList(students);Firstly, add a new node at the end.var newNode = list.AddLast("Emma");Now, use the AddAfter() method to add a node after the given node.list.AddAfter(newNode, "Matt");The following is the complete code.Example Live Demousing System; using System.Collections.Generic; ... Read More

C# Program to skip elements from a sequence as long as the specified condition is true

Chandu yadav

Chandu yadav

Updated on 23-Jun-2020 07:17:02

235 Views

Use the SkipWhile() method to skip elements from a sequence as long as the specified condition is true.The following is the array −int[] marks = { 35, 42, 48, 88, 55, 90, 95, 85 };Here is the condition.s => s >= 50As long as the above condition is true, the ... Read More

C# Enum IsDefined Method

Chandu yadav

Chandu yadav

Updated on 23-Jun-2020 07:14:32

2K+ Views

The IsDefined method returns true if a given integral value, or its name as a string, is present in a specified enum.The following is our enum −enum Subjects { Maths, Science, English, Economics };The above is initialized by default i.e.Maths = 0, Science = 1, English = 2, Economics = ... Read More

C# Program to add a node at the first position in a Linked List

Chandu yadav

Chandu yadav

Updated on 23-Jun-2020 07:10:46

431 Views

Firstly, set a LinkedList with nodes.string [] students = {"Tim", "Jack", "Henry", "David", "Tom"}; LinkedList list = new LinkedList(students);To add a node at the first position, use the AddFirst() method.list.AddFirst("Amit");Example Live Demousing System; using System.Collections.Generic; class Demo {    static void Main() {       string [] students = {"Tim", ... Read More

Advertisements