Programming Articles

Page 842 of 2547

What are the interfaces implemented by Array class in C#?

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

The System.Array class in C# implements several important interfaces that provide essential functionality for array operations. These interfaces include ICloneable, IList, ICollection, and IEnumerable, each serving specific purposes in array manipulation and iteration. Understanding these interfaces helps you leverage the full capabilities of arrays in C# and work with them more effectively in different scenarios. Interfaces Implemented by Array Class Interface Purpose Key Methods/Properties ICloneable Creates a shallow copy of the array Clone() IList Provides indexed access and modification this[index], Add(), Remove() ICollection Provides count and ...

Read More

Important Keywords in C#

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

C# provides several important keywords that control class behavior, method accessibility, and parameter handling. These keywords include sealed, params, internal, this, and abstract, each serving specific purposes in object-oriented programming. Sealed Keyword The sealed keyword prevents a class from being inherited or a method from being overridden. When applied to a method, it must be an overridden method in a derived class. Syntax public sealed class ClassName { } public sealed override void MethodName() { } Example using System; class Animal { public virtual void ...

Read More

C# Program to check if a character is a whitespace character

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

In C#, a whitespace character includes spaces, tabs, newlines, and other invisible characters used for formatting text. The char.IsWhiteSpace() method provides an easy way to identify these characters programmatically. Syntax Following is the syntax for using char.IsWhiteSpace() method − bool result = char.IsWhiteSpace(character); Parameters The method takes a single parameter − character − The character to be tested for whitespace. Return Value Returns true if the character is a whitespace character; otherwise, returns false. Using char.IsWhiteSpace() with Different Whitespace Characters The method recognizes various types of ...

Read More

Implicit conversion from Byte to Decimal in C#

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

Byte represents an 8-bit unsigned integer that can store values from 0 to 255. Implicit conversion from byte to decimal is possible in C# because there is no loss of data − all byte values can be exactly represented as decimal values. Implicit conversion happens automatically without requiring any casting operator or explicit conversion method. Syntax The syntax for implicit conversion from byte to decimal is − byte byteValue = value; decimal decimalValue = byteValue; // Implicit conversion How Implicit Conversion Works When you assign a byte value to a decimal variable, ...

Read More

UInt16.GetTypeCode() Method in C# with Examples

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 155 Views

The UInt16.GetTypeCode() method in C# is used to return the TypeCode for value type UInt16. This method is part of the IConvertible interface and provides a way to identify the underlying data type at runtime. The TypeCode enumeration represents different data types in .NET, and for all UInt16 values, this method always returns TypeCode.UInt16. Syntax Following is the syntax for the UInt16.GetTypeCode() method − public TypeCode GetTypeCode(); Return Value This method returns TypeCode.UInt16, which is the enumerated constant for the UInt16 data type. Using GetTypeCode() with Different UInt16 Values Example ...

Read More

DateTimeOffset.AddMonths() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 428 Views

The DateTimeOffset.AddMonths() method in C# is used to add a specified number of months to a DateTimeOffset instance. This method returns a new DateTimeOffset object with the month value adjusted while preserving the time zone offset information. Syntax Following is the syntax for the AddMonths() method − public DateTimeOffset AddMonths(int months); Parameters months − An integer representing the number of months to add. Use a positive value to add months or a negative value to subtract months. Return Value Returns a new DateTimeOffset object that represents the date and time that ...

Read More

C# program to count the occurrences of each character

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

Counting character occurrences in a string is a common programming task in C#. This can be accomplished using various approaches, from basic loops to modern LINQ methods and dictionary-based solutions. Using Basic Loop with String Manipulation The first approach uses a while loop and string replacement to count occurrences − using System; public class Demo { public static void Main() { string str = "Website"; Console.WriteLine("String: " + str); ...

Read More

What are the prerequisites for learning C#?

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

To start learning C#, you should have basic computer knowledge and familiarity with fundamental programming concepts. While prior experience with C or C++ is helpful, it is not mandatory − C# is beginner-friendly and can be your first programming language. Prerequisites Here are the essential prerequisites for learning C# − Basic Computer Skills: Understanding how to navigate files, folders, and install software. Programming Fundamentals: Basic knowledge of variables, loops, and conditional statements (helpful but not required). Mathematical Logic: Understanding of basic mathematical operations and logical thinking. Object-Oriented Concepts: Familiarity ...

Read More

Inbuilt Data Structures in C#

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

C# provides several powerful built-in data structures that make it easier to store, organize, and manipulate collections of data. These data structures are part of the .NET Framework and offer different capabilities for various programming scenarios. The most commonly used built-in data structures include List for dynamic arrays, ArrayList for non-generic collections, Dictionary for key-value pairs, and Queue and Stack for specialized ordering operations. List The generic List is a strongly-typed collection that can dynamically resize itself. Unlike arrays, you don't need to specify the size at compile time, and it provides better type safety compared to ...

Read More

How to input multiple values from user in one line in C#?

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

In C#, you can input multiple values from the user in one line using several approaches. The most common method is using Console.ReadLine() with Split() to parse space-separated or comma-separated values into an array. Syntax Following is the syntax for reading multiple values in one line using Split() − string input = Console.ReadLine(); string[] values = input.Split(' '); // or Split(', ') for comma-separated For converting to integers − int[] numbers = input.Split(' ').Select(int.Parse).ToArray(); Using Split() with Space Separator This approach reads a single line of space-separated values and ...

Read More
Showing 8411–8420 of 25,466 articles
« Prev 1 840 841 842 843 844 2547 Next »
Advertisements