Articles on Trending Technologies

Technical articles with clear explanations and examples

What is the Count property of SortedList class in C#?

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

The Count property of the SortedList class in C# returns the number of key-value pairs stored in the collection. This read-only property is useful for determining the size of the sorted list and performing operations that depend on the collection's current size. Syntax Following is the syntax for accessing the Count property − int count = sortedList.Count; Return Value The Count property returns an int value representing the total number of key-value pairs currently stored in the SortedList. Example The following example demonstrates how to use the Count property to get ...

Read More

What are rvalue and lvalue in C#?

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

In C#, expressions are categorized into two types based on their position and usage in assignment operations: lvalue and rvalue. Understanding these concepts helps in writing correct assignment statements and understanding compiler errors. Definitions lvalue − An expression that represents a memory location and can appear on either the left-hand or right-hand side of an assignment. The term "lvalue" means "left value". rvalue − An expression that represents a value and can only appear on the right-hand side of an assignment. The term "rvalue" means "right value". ...

Read More

Represent Int32 as a Octal String in C#

George John
George John
Updated on 17-Mar-2026 1K+ Views

To represent Int32 as an octal string in C#, use the Convert.ToString() method with base 8 as the second parameter. An Int32 represents a 32-bit signed integer that can hold values from -2, 147, 483, 648 to 2, 147, 483, 647. Syntax Following is the syntax for converting an Int32 to octal string − Convert.ToString(intValue, 8) Parameters intValue − The integer value to convert. 8 − The base for octal representation. Return Value The method returns a string representing the integer in octal format (base ...

Read More

How to use the GetValue() method of array class in C#?

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

The GetValue() method of the Array class in C# retrieves the value at a specified position in a multi-dimensional or single-dimensional array. This method is particularly useful when working with arrays created using Array.CreateInstance(), as it provides a generic way to access array elements regardless of the array's underlying type. Syntax Following is the syntax for using GetValue() with different array dimensions − // For single-dimensional array object value = array.GetValue(index); // For multi-dimensional array object value = array.GetValue(index1, index2); object value = array.GetValue(index1, index2, index3); Parameters index − A 32-bit ...

Read More

CharEnumerator.MoveNext() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 430 Views

The CharEnumerator.MoveNext() method in C# advances the internal index of the current CharEnumerator object to the next character of the enumerated string. It returns true if the enumerator successfully moved to the next character, or false if it has passed the end of the string. Syntax public bool MoveNext(); Return Value The method returns a bool value − true − if the enumerator was successfully advanced to the next character false − if the enumerator has passed the end of the string ...

Read More

Math.Sign() Method in C#

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

The Math.Sign() method in C# is used to return an integer that indicates the sign of a number. It returns +1 for positive numbers, -1 for negative numbers, and 0 for zero. Syntax The Math.Sign() method has multiple overloads to handle different numeric types − public static int Sign(sbyte value); public static int Sign(short value); public static int Sign(int value); public static int Sign(long value); public static int Sign(float value); public static int Sign(double value); public static int Sign(decimal value); Return Value The method returns an int value − -1 if ...

Read More

C# and Multiple Inheritance

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

C# does not support multiple inheritance of classes, meaning a class cannot inherit from more than one base class directly. However, C# provides interfaces to achieve similar functionality to multiple inheritance by allowing a class to implement multiple interfaces. Multiple inheritance allows a class to inherit features from multiple parent classes. While this can be powerful, it can also lead to complexity and ambiguity, which is why C# chose to support only single inheritance of classes. Why Multiple Inheritance is Not Supported C# avoids multiple class inheritance to prevent the diamond problem, where ambiguity arises when two ...

Read More

How is a new object created in C#?

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

In C#, creating objects is fundamental to object-oriented programming. An object is an instance of a class that represents a real-world entity. Objects allow you to access class members including fields, properties, and methods using the dot operator. Syntax Following is the basic syntax for creating a new object in C# − ClassName objectName = new ClassName(); You can also initialize an object with constructor parameters − ClassName objectName = new ClassName(parameter1, parameter2); Object Creation Process When you create an object using the new keyword, the following steps occur: ...

Read More

How to use NameValueCollection class in C#?

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

The NameValueCollection class in C# is a specialized collection that allows storing multiple values for a single key. It belongs to the System.Collections.Specialized namespace and is particularly useful for handling web form data, query strings, and HTTP headers where duplicate keys might exist. Unlike regular dictionaries that allow only one value per key, NameValueCollection can associate multiple string values with a single string key, making it ideal for scenarios like handling multiple form inputs with the same name. Syntax Following is the basic syntax for creating and using a NameValueCollection − NameValueCollection collection = new ...

Read More

Write a C# program to solve FizzBuzz problem

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

The FizzBuzz problem is a classic programming exercise that tests basic conditional logic and loop implementation. The problem requires printing numbers from 1 to 100 with specific substitutions based on divisibility rules. Problem Statement The FizzBuzz problem states that − Display "Fizz" instead of the number for each multiple of 3 Display "Buzz" instead of the number for each multiple of 5 Display "FizzBuzz" instead of the number for each multiple of both 3 and 5 Display the number itself if it's not a multiple of 3 or 5 FizzBuzz ...

Read More
Showing 10871–10880 of 61,297 articles
Advertisements