Articles on Trending Technologies

Technical articles with clear explanations and examples

DateTimeOffset.FromUnixTimeSeconds() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 988 Views

The DateTimeOffset.FromUnixTimeSeconds() method in C# is used to convert a Unix timestamp (expressed as seconds since January 1, 1970, 00:00:00 UTC) to a DateTimeOffset value. This method is particularly useful when working with Unix-based systems or APIs that return timestamps in Unix format. Syntax Following is the syntax − public static DateTimeOffset FromUnixTimeSeconds(long seconds); Parameters seconds: A Unix time, expressed as the number of seconds that have elapsed since 1970-01-01T00:00:00Z (January 1, 1970, at 12:00 AM UTC). This parameter accepts both positive and negative values. Return Value Returns a DateTimeOffset object ...

Read More

What does the interface IList do in C#?

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

The IList interface in C# represents a non-generic collection of objects that can be individually accessed by index. It provides indexed access to elements, allowing you to retrieve, modify, add, and remove items at specific positions within the collection. The IList interface combines the functionality of ICollection and IEnumerable, making it suitable for collections that need both indexed access and dynamic resizing capabilities. Syntax Following is the syntax for declaring an IList variable − IList list = new ArrayList(); IList list = new List(); Following is the syntax for accessing elements by index ...

Read More

What is the System.Reflection.Module in C#?

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

The System.Reflection.Module class in C# represents a module, which is a portable executable file containing one or more classes and interfaces. It is part of the System.Reflection namespace that allows you to examine and manipulate metadata about types, assemblies, and modules at runtime. A module is essentially a single file within an assembly. Most .NET applications consist of a single module that matches the assembly, but complex applications can have multiple modules within one assembly. Key Properties and Methods The Module class provides several important properties and methods for reflection − Assembly − Gets the ...

Read More

C# program to print duplicates from a list of integers

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

To print duplicates from a list of integers in C#, you can use several approaches. The most common method involves using a Dictionary to count occurrences of each element, then filtering elements that appear more than once. Using Dictionary with ContainsKey This approach uses a Dictionary to store each number and its count. The ContainsKey method checks if a number already exists in the dictionary − using System; using System.Collections.Generic; class Program { public static void Main() { int[] arr = { 3, ...

Read More

Exit Methods in C# Application

radhakrishna
radhakrishna
Updated on 17-Mar-2026 12K+ Views

In C# applications, there are several methods to exit or terminate the application. Each method serves different purposes and has specific use cases. Understanding when and how to use each exit method is crucial for proper application lifecycle management. Environment.Exit() Method The Environment.Exit() method terminates the entire process and returns an exit code to the operating system. This is the most common way to exit a console application. Syntax Environment.Exit(exitCode); The exitCode parameter indicates the success or failure status − 0 − Indicates successful completion Non-zero values − ...

Read More

Return the total elements in a sequence as a 64-bit signed integer in C#

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

The LongCount() method in C# returns the total number of elements in a sequence as a 64-bit signed integer (long). This method is particularly useful when dealing with large datasets where the element count might exceed the range of a regular 32-bit integer. The LongCount() method is available in both LINQ to Objects and LINQ to Entities, and can be used with any IEnumerable or IQueryable collection. Syntax Following is the syntax for using LongCount() method − public static long LongCount(this IEnumerable source) public static long LongCount(this IEnumerable source, Func predicate) Parameters ...

Read More

Cohesion in C#

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

Cohesion in C# refers to how closely related and focused the responsibilities within a class or module are. It measures the functional strength and unity of a module's elements. High cohesion means that a class has a single, well-defined purpose with all its methods working together toward that purpose. The greater the cohesion, the better the program design becomes. High cohesion leads to more maintainable, reusable, and understandable code, while low cohesion results in classes that are difficult to maintain and test. Types of Cohesion Cohesion can be categorized from lowest to highest quality − ...

Read More

How to create 1-Tuple or Singleton Tuple in C#?

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 206 Views

The Tuple class in C# represents a 1-tuple or singleton tuple, which is a data structure that holds a single element. Unlike regular variables, tuples provide additional functionality and can be useful when you need to treat a single value as part of a tuple-based system. Syntax Following is the syntax for creating a 1-tuple − Tuple tupleName = new Tuple(value); Accessing the value using the Item1 property − T value = tupleName.Item1; Using 1-Tuple with Integer Values The following example demonstrates creating and using a 1-tuple with an ...

Read More

What does the interface ICloneable do in C#?

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

The ICloneable interface in C# provides a mechanism to create a copy of an existing object, known as cloning. This interface is part of the System namespace and defines a standard way to duplicate objects. Syntax The ICloneable interface contains only one method − public interface ICloneable { object Clone(); } To implement ICloneable, a class must provide the Clone() method − public class MyClass : ICloneable { public object Clone() { // return a copy ...

Read More

How to convert a list to string in C#?

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

In C#, you can convert a List to a string using various methods. The most common and efficient approach is using the string.Join() method, which concatenates all elements of a list into a single string with a specified delimiter. Syntax Following is the syntax for converting a list to string using string.Join() − string result = string.Join(delimiter, list); Where delimiter is the separator between elements, and list is your List collection. Using string.Join() Method The string.Join() method is the most efficient way to convert a list to string. It accepts a delimiter ...

Read More
Showing 11421–11430 of 61,303 articles
Advertisements