Programming Articles

Page 75 of 2547

Stack.IsSynchronized Property in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 134 Views

The Stack.IsSynchronized property in C# is used to get a value indicating whether access to the Stack is synchronized (thread-safe). This property returns false for the standard Stack class, as it is not thread-safe by default. Syntax Following is the syntax of the IsSynchronized property − public virtual bool IsSynchronized { get; } Return Value This property returns true if the Stack is synchronized (thread-safe); otherwise, it returns false. For the default Stack implementation, this property always returns false. Understanding Thread Safety in Stack The standard Stack class is not thread-safe, ...

Read More

Stack.Peek() Method in C#

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

The Stack.Peek() method in C# is used to return the object at the top of the Stack without removing it. This method is essential when you need to examine the top element while keeping the stack structure intact. Syntax Following is the syntax for the Stack.Peek() method − public virtual object Peek(); Return Value The method returns the object at the top of the Stack. If the stack is empty, it throws an InvalidOperationException. Stack.Peek() Operation Item 3 ...

Read More

Inverting all bit values in BitArray in C#

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

The BitArray class in C# is a collection of Boolean values represented as bits (1's and 0's). It is part of the System.Collections namespace and provides efficient storage and manipulation of binary data. One common operation is inverting all bit values in a BitArray. Syntax Following are the common methods to invert all bits in a BitArray − // Using built-in Not() method bitArray.Not(); // Using XOR with true bits[i] ^= true; // Using Set() method with negation bits.Set(i, !bits[i]); Using the Built-in Not() Method The simplest way to invert all ...

Read More

C# Int16 Struct

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 545 Views

The Int16 Struct in C# represents a 16-bit signed integer with values ranging from -32, 768 to 32, 767. It is also commonly known as the short data type and is part of the .NET value types that directly inherit from System.ValueType. Int16 Value Range -32, 768 MinValue 0 32, 767 MaxValue Fields The Int16 struct provides two important constant fields − ...

Read More

How to create a StringDictionary in C#?

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 137 Views

The StringDictionary in C# is a specialized collection class from the System.Collections.Specialized namespace that stores key-value pairs where both keys and values are strings. It's important to note that StringDictionary is case-insensitive and automatically converts all keys to lowercase. Note: StringDictionary is considered legacy and is generally replaced by Dictionary in modern C# applications. However, understanding StringDictionary is useful for maintaining older codebases. Syntax Following is the syntax for creating and using a StringDictionary − StringDictionary stringDict = new StringDictionary(); stringDict.Add("key", "value"); string value = stringDict["key"]; StringDictionary Key Conversion ...

Read More

Is operator in C#

Jaisshree
Jaisshree
Updated on 17-Mar-2026 522 Views

The is operator in C# is a type-compatibility operator that checks if an object is compatible with a specific type. It returns true if the object is compatible with the specified type, otherwise it returns false. This operator is essential for type checking and safe casting operations in C#. Syntax Following is the basic syntax of the is operator − expression is type Where expression is the object to check, and type is the type to check against. Basic Type Checking Example using System; class Program { ...

Read More

How to find the length of the StringBuilder in C#?

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 308 Views

The StringBuilder class in C# provides the Length property to determine the number of characters currently stored in the StringBuilder object. This property is essential for string manipulation operations and memory management. Syntax Following is the syntax to get the length of a StringBuilder − int length = stringBuilder.Length; Understanding Length vs Capacity It's important to distinguish between Length and Capacity of a StringBuilder − Property Description Length Number of characters currently stored in the StringBuilder Capacity Maximum number of characters the StringBuilder ...

Read More

How to check whether the given matrix is a Toeplitz matrix using C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 751 Views

A Toeplitz matrix is a special matrix where every diagonal running from top-left to bottom-right contains identical elements. In other words, for any element at position matrix[i][j], it should be equal to matrix[i-1][j-1]. This property makes Toeplitz matrices useful in signal processing, time series analysis, and various mathematical applications. Toeplitz Matrix Diagonals 1 2 3 4 5 1 2 3 9 5 1 2 ...

Read More

C# Int32 Struct

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 659 Views

The Int32 struct in C# represents a 32-bit signed integer. It is an immutable value type that represents signed integers with values ranging from -2, 147, 483, 648 to 2, 147, 483, 647. The int keyword in C# is an alias for Int32. This struct provides various fields and methods for working with 32-bit integers, including comparison, parsing, and conversion operations. Syntax Following is the syntax for declaring an Int32 variable − int variableName = value; Int32 variableName = value; Fields The Int32 struct provides two important constant fields − ...

Read More

C# Int16.ToString() Method

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 247 Views

The Int16.ToString() method in C# is used to convert a 16-bit signed integer (short) to its equivalent string representation. This method provides multiple overloads to format the output string according to your specific requirements. Syntax Following are the different overloads of the Int16.ToString() method − public override string ToString(); public string ToString(string format); public string ToString(IFormatProvider provider); public string ToString(string format, IFormatProvider provider); Parameters format − A numeric format string that specifies the format of the return value. provider − An object that supplies culture-specific formatting information. ...

Read More
Showing 741–750 of 25,467 articles
« Prev 1 73 74 75 76 77 2547 Next »
Advertisements