Server Side Programming Articles

Page 697 of 2109

C# Copy() Method

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 536 Views

The String.Copy() method in C# creates a new string instance with the same value as the specified string. While strings are immutable in C#, this method ensures you get a completely separate string object in memory, which can be useful in certain scenarios involving string interning. Syntax Following is the syntax for the String.Copy() method − public static string Copy(string str); Parameters str − The string to copy. Cannot be null. Return Value Returns a new string with the same value as the input string but as a separate ...

Read More

TimeSpan.FromMinutes() Method in C#

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

The TimeSpan.FromMinutes() method in C# is used to return a TimeSpan that represents a specified number of minutes, where the specification is accurate to the nearest millisecond. This static method is particularly useful when you need to create time intervals based on minute values. Syntax Following is the syntax for the TimeSpan.FromMinutes() method − public static TimeSpan FromMinutes(double value); Parameters value − A double representing the number of minutes, accurate to the nearest millisecond. Can be positive or negative. Return Value Returns a TimeSpan object that represents ...

Read More

TimeSpan.FromSeconds() Method in C#

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

The TimeSpan.FromSeconds() method in C# is used to return a TimeSpan that represents a specified number of seconds, where the specification is accurate to the nearest millisecond. This static method is particularly useful when you need to create time intervals based on second values. Syntax Following is the syntax for the TimeSpan.FromSeconds() method − public static TimeSpan FromSeconds(double value); Parameters value − A number of seconds, accurate to the nearest millisecond. Can be positive, negative, or zero. Return Value Returns a TimeSpan object that represents the specified number of ...

Read More

C# BitConverter.ToUInt16() Method

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 452 Views

The BitConverter.ToUInt16() method in C# converts two consecutive bytes from a byte array into a 16-bit unsigned integer (ushort). This method is particularly useful when working with binary data, network protocols, or file formats that store numeric values as byte sequences. Syntax public static ushort ToUInt16(byte[] value, int startIndex); Parameters value: The byte array containing the bytes to convert. startIndex: The starting position within the byte array (must have at least 2 bytes remaining). Return Value Returns a 16-bit unsigned integer (ushort) formed by combining two bytes from the specified ...

Read More

C# String Properties

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 929 Views

The String class in C# provides essential properties that allow you to access and examine string data. The two primary properties are Chars for accessing individual characters and Length for determining the string size. String Properties Following are the key properties of the String class in C# − Property Description Chars Gets the Char object at a specified position in the current String object using indexer syntax. Length Gets the number of characters in the current String object. Syntax Following is the syntax ...

Read More

Thread.CurrentThread Property in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 329 Views

The Thread.CurrentThread property in C# is used to get a reference to the currently executing thread. This static property returns the Thread object representing the thread that is currently running, allowing you to access information about the current thread's state, name, ID, and other properties. Syntax The syntax for accessing the current thread is as follows − public static System.Threading.Thread CurrentThread { get; } Return Value This property returns a Thread object that represents the currently executing thread. Through this object, you can access various thread properties and methods. Using Thread.CurrentThread for ...

Read More

StringBuilder.Chars[] Property in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 163 Views

The StringBuilder.Chars[] property in C# provides indexed access to individual characters within a StringBuilder instance. This property allows you to both get and set characters at specific positions, making it useful for character-level manipulations without converting the entire StringBuilder to a string. Syntax Following is the syntax for the StringBuilder.Chars[] property − public char this[int index] { get; set; } Parameters index − The zero-based position of the character to get or set. Must be within the bounds of the StringBuilder (0 to Length-1). Return Value Returns ...

Read More

Queue.Clear Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 291 Views

The Queue.Clear() method in C# is used to remove all elements from a Queue collection. This method provides an efficient way to empty the entire queue in a single operation, setting the count to zero. Syntax Following is the syntax for the Clear() method − public void Clear(); Parameters The Clear() method does not take any parameters. Return Value The method does not return any value. It is a void method that modifies the queue in place. Queue.Clear() Operation ...

Read More

Queue.Clone() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 352 Views

The Queue.Clone() method in C# is used to create a shallow copy of the Queue. This method returns a new Queue object that contains references to the same elements as the original Queue, but the Queue structure itself is independent. Syntax Following is the syntax for the Queue.Clone() method − public virtual object Clone(); Return Value The method returns an object that represents a shallow copy of the Queue. You need to cast it back to Queue type to use it as a Queue. Understanding Shallow Copy A shallow copy means ...

Read More

Queue.Contains() Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 245 Views

The Queue.Contains() method in C# is used to determine whether a specific element exists in the Queue. It returns true if the element is found, otherwise false. This method performs a linear search through the queue elements. Syntax Following is the syntax for the Queue.Contains() method − public bool Contains(T item); Parameters item − The object to locate in the Queue. The value can be null for reference types. Return Value Returns true if the item is found in the Queue; otherwise, false. ...

Read More
Showing 6961–6970 of 21,090 articles
« Prev 1 695 696 697 698 699 2109 Next »
Advertisements