Articles on Trending Technologies

Technical articles with clear explanations and examples

C# Queryable Union Method

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

The Queryable Union method in C# performs a set union operation on two sequences, returning all unique elements from both sequences. It removes duplicate elements and preserves the order of first occurrence. Syntax Following is the syntax for the Queryable Union method − public static IQueryable Union( this IQueryable source1, IEnumerable source2 ) Parameters source1 − An IQueryable whose distinct elements form the first set for the union. source2 − An IEnumerable whose distinct elements form the second set for the union. ...

Read More

Type.GetTypeArray() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 134 Views

The Type.GetTypeArray() method in C# is used to retrieve the Type objects representing the runtime types of all elements in a specified object array. This method is particularly useful in reflection scenarios where you need to determine the actual types of objects at runtime. Syntax Following is the syntax − public static Type[] GetTypeArray (object[] args); Parameters args − An array of objects whose types are to be determined. Return Value This method returns an array of Type objects representing the types of the corresponding elements in ...

Read More

Remove Leading Zeros from a String in C#

Ankith Reddy
Ankith Reddy
Updated on 17-Mar-2026 14K+ Views

Removing leading zeros from a string is a common requirement in C# when dealing with numeric data or formatted strings. There are several approaches to accomplish this task, with TrimStart() being the most straightforward method. Syntax Following is the syntax for using TrimStart() to remove leading zeros − string.TrimStart('0') string.TrimStart(new char[] { '0' }) Using TrimStart() Method The TrimStart() method removes specified characters from the beginning of a string. To remove leading zeros, we pass '0' as the character to trim − using System; class Program { ...

Read More

C# Program to get the first three elements from a list

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

The Take() method in C# is a LINQ extension method used to retrieve a specified number of elements from the beginning of a collection. It returns an IEnumerable containing the first n elements from the original collection. Syntax Following is the syntax for using the Take() method − IEnumerable Take(int count) Parameters count − An integer specifying the number of elements to return from the start of the sequence. Return Value The Take() method returns an IEnumerable that contains the specified number of elements from the start ...

Read More

C# Linq LastorDefault Method

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

The LastOrDefault() method in C# LINQ returns the last element of a sequence, or a default value if the sequence is empty. This method prevents exceptions that would occur with Last() when called on empty collections. Syntax Following is the syntax for LastOrDefault() method − public static T LastOrDefault(this IEnumerable source); public static T LastOrDefault(this IEnumerable source, Func predicate); Parameters source − The sequence to return the last element from. predicate − A function to test each element for a condition (optional). Return Value Returns the last element that ...

Read More

Convert.ToBase64String() Method in C#

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

The Convert.ToBase64String() method in C# is used to convert the value of an array of 8-bit unsigned integers to its equivalent string representation that is encoded with base-64 digits. This is commonly used for encoding binary data into a text format that can be safely transmitted or stored. Syntax Following is the syntax − public static string ToBase64String(byte[] inArray); Parameters inArray − An array of 8-bit unsigned integers to be converted to Base64 string. Return Value Returns a string representation of the contents of the byte array ...

Read More

Type.GetTypeCode() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 280 Views

The Type.GetTypeCode() method in C# is used to get the underlying type code of the specified Type. It returns a TypeCode enumeration value that represents the type classification of the given Type object. Syntax Following is the syntax − public static TypeCode GetTypeCode(Type type); Parameters type − The Type object whose underlying type code is to be retrieved. Return Value Returns a TypeCode enumeration value that represents the type category. If the type is null, it returns TypeCode.Empty. Using GetTypeCode() with Built-in Types Example ...

Read More

Typeof() vs GetType() in C#

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

In C#, both typeof() and GetType() are used to obtain type information, but they work differently. typeof() is a compile-time operator that returns the Type object for a specified type, while GetType() is a runtime method that returns the actual type of an object instance. Syntax Following is the syntax for using typeof() operator − Type type = typeof(TypeName); Following is the syntax for using GetType() method − Type type = objectInstance.GetType(); Using typeof() Operator The typeof() operator takes a type name as its argument and returns the Type ...

Read More

C# Linq Zip Method

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

The Zip method in C# LINQ is used to merge two sequences element by element using a specified predicate function. It combines corresponding elements from two collections into a single sequence, creating pairs from the first element of each sequence, then the second element of each, and so on. The method stops when the shorter sequence is exhausted, making it safe to use with sequences of different lengths. Syntax Following is the syntax for the Zip method − public static IEnumerable Zip( this IEnumerable first, IEnumerable second, ...

Read More

Int32. Equals Method in C# with Examples

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 308 Views

The Int32.Equals() method in C# is used to compare the current integer instance with another value to determine if they are equal. It returns a boolean value indicating whether the comparison values are equal or not. Syntax The Int32.Equals() method has two overloaded forms − public bool Equals(int other); public override bool Equals(object obj); Parameters other − An Int32 value to compare with the current instance. obj − An object to compare with the current instance. Return Value Both overloads return a bool value − true if ...

Read More
Showing 11031–11040 of 61,297 articles
Advertisements