Articles on Trending Technologies

Technical articles with clear explanations and examples

What are punctuators in C#?

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

Punctuators are special symbols in C# that serve as delimiters to structure, group, and organize code. They are essential for proper syntax and help the compiler understand where statements begin and end, how to group code blocks, and how to separate elements. Common Punctuators in C# The most frequently used punctuators in C# include − { } // Braces - code blocks ( ) // Parentheses - method calls, grouping [ ] // Brackets - arrays, indexers ; // Semicolon - statement terminator , ...

Read More

Literal number suffixes in C#

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

Literal number suffixes in C# are used to explicitly specify the data type of numeric literals. Without suffixes, the compiler infers the type based on the value, but suffixes ensure the literal is treated as a specific numeric type. These suffixes are particularly useful when working with method overloads, preventing ambiguous type conversions, and ensuring the correct data type is used for calculations. Syntax Following is the syntax for using literal number suffixes − dataType variable = numericValue + suffix; The suffix can be either uppercase or lowercase, but uppercase is recommended for ...

Read More

C# Program to order array elements

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

C# provides several methods to order array elements. The OrderBy() method sorts elements in ascending order, while ThenBy() is used for secondary sorting criteria when multiple elements have the same primary sort value. Syntax Following is the syntax for ordering array elements using LINQ methods − // Primary ordering IEnumerable result = array.OrderBy(item => item.Property); // Primary and secondary ordering IEnumerable result = array.OrderBy(item => item.Property1) ...

Read More

Boolean.Equals(Object) Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 222 Views

The Boolean.Equals(Object) method in C# returns a value indicating whether the current Boolean instance is equal to a specified object. This method compares the Boolean value with another object, returning true only if the object is also a Boolean with the same value. Syntax Following is the syntax − public override bool Equals (object obj); Parameters obj − An object to compare with this Boolean instance. Return Value Returns true if the object is a Boolean instance with the same value; otherwise, false. Using Boolean.Equals() with Different Data Types ...

Read More

C# Program to convert first character uppercase in a sentence

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

Converting the first character of each word to uppercase in a sentence is a common text formatting task in C#. This process involves identifying word boundaries and converting the first lowercase letter of each word to its uppercase equivalent. Syntax Following is the basic approach to convert characters from lowercase to uppercase − char uppercaseChar = (char)(lowercaseChar - 'a' + 'A'); To check if a character is a lowercase letter − if (ch >= 'a' && ch = 'a' && val[i] = 'A' && val[i] word.Length > 0 ? ...

Read More

What are sealed modifiers in C#?

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

The sealed modifier in C# prevents method overriding in derived classes. When applied to an overridden method, it stops further inheritance of that method. The sealed method must be part of a derived class and must override a virtual or abstract method from its base class. Syntax Following is the syntax for declaring a sealed method − public sealed override ReturnType MethodName() { // method implementation } Key Rules for Sealed Methods A sealed method must be an override of a virtual or abstract method. Once ...

Read More

How to generate the first 100 Odd Numbers using C#?

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

To generate the first 100 odd numbers in C#, you can use different approaches. The most straightforward method is to iterate through numbers and check if they are odd using the modulus operator. Syntax Following is the syntax for checking if a number is odd − if (number % 2 != 0) { // number is odd } Following is the syntax for generating odd numbers in a loop − for (int i = 1; i

Read More

ElementAt() method in C#

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

The ElementAt() method in C# is a LINQ extension method that retrieves an element at a specified index from any collection that implements IEnumerable. It provides a way to access elements by index in collections that don't have built-in indexing support. Syntax Following is the syntax for the ElementAt() method − public static TSource ElementAt(this IEnumerable source, int index) Parameters source − The IEnumerable to return an element from. index − The zero-based index of the element to retrieve. Return Value Returns the element at the specified position in ...

Read More

C# Program to order array elements in descending order

Samual Sam
Samual Sam
Updated on 17-Mar-2026 348 Views

To order array elements in descending order in C#, you can use various approaches including Array.Sort() with reversal, LINQ's OrderByDescending(), or custom comparison methods. These methods provide flexibility for sorting different data types and applying custom sorting criteria. Syntax Following is the syntax for basic descending sort using Array.Sort() and Array.Reverse() − Array.Sort(arrayName); Array.Reverse(arrayName); Following is the syntax for LINQ OrderByDescending() − var result = array.OrderByDescending(element => element); Using Array.Sort() and Array.Reverse() The simplest approach is to sort the array in ascending order first, then reverse it − ...

Read More

Boolean.Parse() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 2K+ Views

The Boolean.Parse() method in C# is used to convert the specified string representation of a logical value to its Boolean equivalent. This method converts strings like "true", "false", "TRUE", or "FALSE" to their corresponding boolean values. Syntax Following is the syntax − public static bool Parse(string value); Parameters value − A string containing the value to convert. It can be "true", "false", "True", "False", "TRUE", or "FALSE". Return Value Returns true if the value is equivalent to TrueString, or false if the value is equivalent to FalseString. Using ...

Read More
Showing 11011–11020 of 61,297 articles
Advertisements