Server Side Programming Articles

Page 828 of 2109

Convert.ToInt64 Method in C#

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

The Convert.ToInt64 method in C# converts a specified value to a 64-bit signed integer (long). This method can convert various data types including strings, floating-point numbers, and other numeric types to a long value. Syntax Following are the common syntax overloads for Convert.ToInt64 − public static long ToInt64(object value); public static long ToInt64(string value); public static long ToInt64(double value); public static long ToInt64(float value); public static long ToInt64(decimal value); Parameters value − The value to convert to a 64-bit signed integer Return Value Returns a 64-bit signed integer (long) ...

Read More

C# program to remove the first occurrence of a node in a Linked List

George John
George John
Updated on 17-Mar-2026 194 Views

The LinkedList class in C# provides an efficient way to store and manipulate collections of data. When you need to remove the first occurrence of a specific node from a LinkedList, you can use the Remove() method, which searches for the specified value and removes its first occurrence. Syntax The syntax for removing the first occurrence of a node from a LinkedList is − bool result = linkedList.Remove(value); Parameters value − The value to remove from the LinkedList. The method removes the first node that contains this value. Return Value The Remove()

Read More

Represent Int32 as a Hexadecimal String in C#

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

To represent Int32 as a hexadecimal string in C#, you can use several methods. The most common approaches are using Convert.ToString() with base 16, or using the ToString() method with hexadecimal format specifiers. Int32 represents a 32-bit signed integer that can hold values from -2, 147, 483, 648 to 2, 147, 483, 647. Converting these values to hexadecimal format is useful for debugging, display purposes, and when working with low-level operations. Using Convert.ToString() with Base 16 The Convert.ToString() method accepts a base parameter. Setting it to 16 converts the integer to its hexadecimal representation − ...

Read More

C# Program to find the longest string from an array of strings using Lambda Expression

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

Lambda expressions in C# provide a concise way to write anonymous functions. When working with arrays of strings, you can use lambda expressions with LINQ methods like Aggregate() to perform operations such as finding the longest string. In this example, we'll demonstrate how to find the longest string from an array using the Aggregate() method with a lambda expression. Syntax The Aggregate() method with lambda expression follows this syntax − collection.Aggregate(seed, (accumulator, next) => condition ? next : accumulator, result => transformation) Where − seed − Initial value for comparison accumulator ...

Read More

C# Program to remove a node at the beginning of a Linked List

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

To remove a node at the beginning of a LinkedList in C#, use the RemoveFirst() method. This method removes the first node from the LinkedList and automatically adjusts the internal structure. Syntax Following is the syntax for the RemoveFirst() method − linkedList.RemoveFirst(); This method removes the first node and does not return any value. If the LinkedList is empty, it throws an InvalidOperationException. How It Works When you call RemoveFirst(), the LinkedList performs the following operations − RemoveFirst() Operation ...

Read More

Implicit conversion from Int32 to Decimal in C#

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

The int type represents a 32-bit signed integer (Int32) in C#. C# allows implicit conversion from int to decimal because this conversion is always safe and does not result in data loss. The decimal type has a much larger range and precision than int. Syntax The syntax for implicit conversion from Int32 to decimal is straightforward − int intValue = 123; decimal decimalValue = intValue; // implicit conversion No explicit casting is required because the conversion is safe and automatic. How Implicit Conversion Works When you assign an int value to ...

Read More

C# Program to remove a node at the end of the Linked List

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

In C#, you can remove the last node from a LinkedList using the RemoveLast() method. This method removes and returns the last node in the linked list, making it an efficient way to delete the tail element. Syntax Following is the syntax for removing the last node from a LinkedList − linkedList.RemoveLast(); The RemoveLast() method removes the last node and has no return value. If the list is empty, it throws an InvalidOperationException. How It Works The LinkedList class maintains references to both the first and last nodes. When RemoveLast() is called, ...

Read More

C# Program to rename a file

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

In C#, you can rename a file using the File.Move() method from the System.IO namespace. This method moves a file from one location to another, and when the source and destination paths are in the same directory with different filenames, it effectively renames the file. Syntax Following is the syntax for renaming a file using File.Move() − File.Move(string sourceFileName, string destFileName); Parameters sourceFileName − The current path and name of the file to rename. destFileName − The new path and name for the file. Using File.Move() to Rename Files ...

Read More

Implicit conversion from 8-bit signed integer (SByte) to Decimal in C#

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

SByte represents an 8-bit signed integer with values ranging from -128 to 127. C# allows implicit conversion from sbyte to decimal because this conversion is always safe and does not result in data loss. Syntax Following is the syntax for implicit conversion from sbyte to decimal − sbyte sbyteValue = value; decimal decimalValue = sbyteValue; // implicit conversion How It Works The conversion happens automatically without requiring explicit casting because decimal can represent all possible sbyte values without precision loss. The 8-bit signed integer is widened to fit into the 128-bit decimal ...

Read More

Short Date ("d") Format Specifier

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

The "d" format specifier in C# represents the short date pattern for formatting DateTime values. This standard format specifier produces a compact date representation without time information, making it ideal for displaying dates in a concise format. The format string is defined by the culture's DateTimeFormatInfo.ShortDatePattern property, which varies based on the current culture settings. Syntax Following is the syntax for using the "d" format specifier − DateTime.ToString("d") DateTime.ToString("d", CultureInfo) The default custom format string for invariant culture is − MM/dd/yyyy Using "d" Format Specifier with Different Cultures ...

Read More
Showing 8271–8280 of 21,090 articles
« Prev 1 826 827 828 829 830 2109 Next »
Advertisements