Server Side Programming Articles

Page 837 of 2109

C# Console.WindowWidth Property

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 505 Views

The Console.WindowWidth property gets or sets the width of the console window measured in columns. This property is useful for creating console applications that need to adapt their output formatting based on the current window dimensions. Syntax Following is the syntax to get the console window width − int width = Console.WindowWidth; Following is the syntax to set the console window width − Console.WindowWidth = value; Return Value The property returns an int representing the width of the console window in columns. When setting the property, the value must ...

Read More

Convert.ChangeType Method in C#

Chandu yadav
Chandu yadav
Updated on 17-Mar-2026 3K+ Views

The Convert.ChangeType() method in C# converts a value to a specified type. It returns an object of the target type whose value is equivalent to the original object. This method is particularly useful when you need to perform type conversions at runtime or when working with generic code. Syntax Following is the syntax for the Convert.ChangeType() method − public static object ChangeType(object value, Type conversionType) public static object ChangeType(object value, TypeCode typeCode) Parameters value − The object to convert. conversionType − The target Type to convert to. typeCode − The TypeCode representing ...

Read More

Convert.ToBoolean Method in C#

Samual Sam
Samual Sam
Updated on 17-Mar-2026 2K+ Views

The Convert.ToBoolean method in C# converts a specified value to an equivalent Boolean value. This method follows specific rules depending on the input type − numeric types return false if zero, true otherwise; string values are parsed based on their content. Syntax Following is the syntax for the Convert.ToBoolean method − public static bool ToBoolean(object value); public static bool ToBoolean(string value); public static bool ToBoolean(int value); public static bool ToBoolean(double value); // Other overloads for different data types Parameters value − The value to convert to a Boolean. Can be a ...

Read More

Convert.ToByte Method in C#

Arjun Thakur
Arjun Thakur
Updated on 17-Mar-2026 1K+ Views

The Convert.ToByte method in C# converts a specified value to an 8-bit unsigned integer (byte). A byte can hold values from 0 to 255, making it useful for representing small integers, ASCII characters, and binary data. This method provides a safe way to convert various data types to byte values, with built-in overflow checking that throws an OverflowException if the value is outside the valid byte range. Syntax Following are the common overloads of the Convert.ToByte method − Convert.ToByte(object value) Convert.ToByte(string value) Convert.ToByte(char value) Convert.ToByte(int value) Convert.ToByte(double value) Parameters value − ...

Read More

Convert.ToUInt64 Method in C#

Ankith Reddy
Ankith Reddy
Updated on 17-Mar-2026 216 Views

The Convert.ToUInt64() method in C# converts a specified value to a 64-bit unsigned integer (ulong). This method accepts various data types and returns their equivalent ulong representation. Syntax Following is the syntax for the Convert.ToUInt64() method − public static ulong ToUInt64(object value) public static ulong ToUInt64(string value) public static ulong ToUInt64(char value) public static ulong ToUInt64(int value) public static ulong ToUInt64(double value) Parameters value − The value to convert. Can be of type object, string, char, numeric types, or other convertible types. Return Value Returns a 64-bit ...

Read More

C# Linq Last() Method

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 1K+ Views

The LINQ Last() method in C# returns the last element from a sequence. It throws an exception if the sequence is empty, making it suitable when you are certain the collection contains elements. Syntax Following is the syntax for the Last() method − public static TSource Last(this IEnumerable source); public static TSource Last(this IEnumerable source, Func predicate); Parameters source − The sequence to return the last element from. predicate − (Optional) A function to test each element for a condition. Return Value Returns the last ...

Read More

C# Enum Equals Method

George John
George John
Updated on 17-Mar-2026 800 Views

The Equals() method in C# is used to compare enum values for equality. It returns true if both enum values have the same underlying value, and false otherwise. Syntax Following is the syntax for using the Equals() method with enums − enumValue1.Equals(enumValue2) Parameters enumValue2 − The enum value to compare with the current enum value Return Value The method returns a bool value − true if both enum values are equal false if the enum values are different ...

Read More

Convert.ToUInt32 Method in C#

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 358 Views

The Convert.ToUInt32 method in C# converts a specified value to a 32-bit unsigned integer (uint). This method can convert various data types including strings, integers, floating-point numbers, and other numeric types to an unsigned 32-bit integer. The uint data type can hold values from 0 to 4, 294, 967, 295, making it suitable for scenarios where you need positive integers only with a larger range than regular int. Syntax Following are the common overloads of the Convert.ToUInt32 method − Convert.ToUInt32(string value) Convert.ToUInt32(int value) Convert.ToUInt32(double value) Convert.ToUInt32(object value) Parameters value − The ...

Read More

C# Enum Format Method

Chandu yadav
Chandu yadav
Updated on 17-Mar-2026 873 Views

The Enum.Format method in C# converts the value of a specified enumerated type to its equivalent string representation according to the specified format. This method provides flexible formatting options including decimal, hexadecimal, and name representations. Syntax Following is the syntax for the Enum.Format method − public static string Format(Type enumType, object value, string format) Parameters enumType − The enumeration type of the value to convert. value − The value to convert. format − The output format to use. Common formats are "G" (name), "D" (decimal), "X" (hexadecimal), and "F" (name if defined, ...

Read More

C# Program to return specified number of elements from the beginning of a sequence

Arjun Thakur
Arjun Thakur
Updated on 17-Mar-2026 220 Views

The Take() method in C# is a LINQ extension method that returns a specified number of elements from the beginning of a sequence. This method is particularly useful when you need to retrieve only the first few elements from a collection, especially after sorting or filtering operations. Syntax Following is the syntax for the Take() method − public static IEnumerable Take( this IEnumerable source, int count ) Parameters source − The sequence to return elements from. count − The number of elements to return ...

Read More
Showing 8361–8370 of 21,090 articles
« Prev 1 835 836 837 838 839 2109 Next »
Advertisements