Article Categories
- All Categories
-
Data Structure
-
Networking
-
RDBMS
-
Operating System
-
Java
-
MS Excel
-
iOS
-
HTML
-
CSS
-
Android
-
Python
-
C Programming
-
C++
-
C#
-
MongoDB
-
MySQL
-
Javascript
-
PHP
-
Economics & Finance
Articles on Trending Technologies
Technical articles with clear explanations and examples
Char.IsSymbol() Method in C#
The Char.IsSymbol() method in C# determines whether a specified character is categorized as a symbol character. Symbol characters include mathematical symbols, currency symbols, and other non-alphanumeric characters that are not punctuation or control characters. Syntax The method has two overloads − public static bool IsSymbol(char c); public static bool IsSymbol(string str, int index); Parameters c − The Unicode character to evaluate. str − A string containing the character to evaluate. index − The position of the character to evaluate in the string. Return Value Returns true if the character ...
Read MoreDateTime.FromOADate() Method in C#
The DateTime.FromOADate() method in C# converts an OLE Automation Date value into a DateTime object. OLE Automation Date is a floating-point representation of dates and times where the integer part represents the number of days since December 30, 1899, and the fractional part represents the time of day. Syntax Following is the syntax for the DateTime.FromOADate() method − public static DateTime FromOADate(double d); Parameters The method takes a single parameter − d: A double-precision floating-point number representing the OLE Automation Date value. It can range from -657435.0 to 2958465.99999999. ...
Read MoreReplace a C# array with a new array of different size
To replace a C# array with a new array of different size, use the Array.Resize method. This method allows you to change the size of an existing array, either expanding or shrinking it while preserving existing elements. Syntax Following is the syntax for using Array.Resize − Array.Resize(ref array, newSize); Parameters array − The array to resize (passed by reference using ref) newSize − The new size of the array How It Works When you resize an array: If the new size is ...
Read MoreHow to find maximum between 2 numbers using C#?
Finding the maximum between two numbers in C# can be accomplished using several approaches. The most common methods include using conditional statements, the Math.Max() method, and the ternary operator. Using If-Else Statement The traditional approach uses an if-else statement to compare two numbers and determine which one is larger − using System; class Program { static void Main(string[] args) { int num1 = 50; int num2 = 90; ...
Read MoreInsertion Sort in C#
Insertion Sort is a simple sorting algorithm that builds the sorted array one element at a time. It takes each element from the unsorted portion and inserts it into its correct position within the already sorted portion of the array. The algorithm works similarly to how you might sort playing cards in your hand − you pick up cards one by one and insert each into its proper position among the cards you've already sorted. How Insertion Sort Works The algorithm divides the array into two parts: a sorted portion (initially just the first element) and an ...
Read MoreThread-Safe collections in C#
Thread-safe collections in C# are specialized data structures designed for concurrent programming. The System.Collections.Concurrent namespace, introduced in .NET Framework 4, provides collections that allow multiple threads to safely add, remove, and access items without external synchronization. These collections use lightweight synchronization mechanisms like SpinLock and SpinWait to achieve thread safety while maintaining high performance and scalability. Thread-Safe Collections Overview Thread A Thread B Thread C Concurrent Collection ...
Read MoreC# program to count number of bytes in an array
In C#, you can count the number of bytes in an array using the Buffer.ByteLength() method. This method returns the total number of bytes occupied by all elements in the array, which is particularly useful when working with different data types that have varying byte sizes. Syntax Following is the syntax for using Buffer.ByteLength() − int byteCount = Buffer.ByteLength(array); Parameters array − The array whose byte length you want to determine. It must be an array of primitive types. Return Value The method returns an int representing ...
Read MoreC# Program to check whether a node is a LinkedList or not
The Contains() method in C# is used to check whether a specific value exists in a LinkedList. This method searches through all nodes in the LinkedList and returns a boolean value indicating whether the specified element is found. Syntax Following is the syntax for using the Contains() method − public bool Contains(T item) Parameters item − The value to locate in the LinkedList. Return Value Returns true if the item is found in the LinkedList; otherwise, false. LinkedList Contains() Method ...
Read MoreChar.IsUpper() Method in C#
The Char.IsUpper() method in C# determines whether a specified Unicode character is categorized as an uppercase letter. It returns true if the character is an uppercase letter, otherwise false. Syntax Following is the syntax of the Char.IsUpper() method − public static bool IsUpper(char ch); Parameters ch − The Unicode character to evaluate. Return Value This method returns a bool value − true if the character is an uppercase letter false if the character is not an uppercase letter Using ...
Read Morec# Put spaces between words starting with capital letters
To place spaces between words starting with capital letters in C#, you can use LINQ to examine each character and insert spaces before uppercase letters. This technique is commonly used to format PascalCase strings into readable text. Syntax The basic syntax using LINQ to add spaces before capital letters − string.Concat(str.Select(x => Char.IsUpper(x) ? " " + x : x.ToString())).TrimStart(' '); Using LINQ with Select and IsUpper The following example demonstrates how to add spaces before each uppercase letter in a PascalCase string − using System; using System.Linq; class Demo ...
Read More