Articles on Trending Technologies

Technical articles with clear explanations and examples

Uri.HexEscape(Char) Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 244 Views

The Uri.HexEscape() method in C# converts a specified character into its hexadecimal equivalent representation using percent-encoding. This method is particularly useful for URL encoding where certain characters need to be represented in hexadecimal format for safe transmission in URIs. Syntax Following is the syntax − public static string HexEscape(char ch); Parameters ch − The character to convert to hexadecimal representation. Return Value Returns a string containing the hexadecimal representation of the character in the format %XX, where XX is the two-digit hexadecimal value. HexEscape Character Conversion ...

Read More

How to update the value stored in a Dictionary in C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 7K+ Views

In C#, Dictionary is a generic collection which is generally used to store key/value pairs. In Dictionary, the key cannot be null, but value can be. A key must be unique. Duplicate keys are not allowed if we try to use duplicate key then compiler will throw an exception. As mentioned above a value in a dictionary can be updated by using its key as the key is unique for every value. Syntax Following is the syntax for updating a dictionary value − myDictionary[myKey] = myNewValue; You can also use the TryGetValue method ...

Read More

What is the difference between FromBody and FromUri attributes in C# ASP.NETnWebAPI?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 7K+ Views

In ASP.NET Web API, parameter binding determines how action method parameters receive values from HTTP requests. The [FromUri] and [FromBody] attributes control the source of parameter data, providing explicit control over this binding process. The FromUri attribute forces Web API to bind parameters from the URI query string, route data, or headers instead of the request body. The FromBody attribute instructs Web API to read parameter values from the HTTP request body using formatters like JSON or XML. Syntax Following is the syntax for using [FromUri] attribute − public IActionResult Method([FromUri] ModelClass model) { ...

Read More

Check if StringDictionary is synchronized in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 254 Views

The StringDictionary class in C# provides the IsSynchronized property to check whether the dictionary is synchronized (thread-safe). By default, StringDictionary is not synchronized, meaning it's not safe for concurrent access from multiple threads without external synchronization. Syntax Following is the syntax to check if a StringDictionary is synchronized − bool isSynchronized = stringDictionary.IsSynchronized; Properties IsSynchronized − Returns true if the StringDictionary is synchronized; otherwise, false. SyncRoot − Gets an object that can be used to synchronize access to the StringDictionary. Example 1: Basic Synchronization Check using System; using ...

Read More

Get all the interfaces implemented or inherited by the current Type in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 680 Views

The Type class in C# provides methods to retrieve all interfaces implemented or inherited by a specific type. The GetInterfaces() method returns an array of all interfaces, while GetInterface() method retrieves a specific interface by name. Syntax Following is the syntax for getting all interfaces implemented by a type − Type[] interfaces = type.GetInterfaces(); Following is the syntax for getting a specific interface by name − Type specificInterface = type.GetInterface("InterfaceName", ignoreCase); Parameters GetInterface(string name) − Returns the interface with the specified name. GetInterface(string name, bool ignoreCase) − Returns ...

Read More

How to create Guid value in C#?

Nizamuddin Siddiqui
Nizamuddin Siddiqui
Updated on 17-Mar-2026 2K+ Views

A Globally Unique Identifier or Guid represents a 128-bit identification number that is mathematically guaranteed to be unique across multiple systems and distributed applications. The total number of unique keys (approximately 3.40282366×10³⁸) is so large that the probability of generating the same number twice is negligible. GUIDs are commonly used in applications where unique identification is critical, such as database primary keys, transaction IDs, or session identifiers. They are typically displayed as a sequence of hexadecimal digits like 3F2504E0-4F89-11D3-9A0C-0305E82C3301. Syntax The Guid structure is present in the System namespace. Following are the most common ways to create ...

Read More

Check if ArrayList is Synchronized (thread safe) in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 443 Views

The IsSynchronized property in C# is used to check if an ArrayList is synchronized (thread-safe). By default, ArrayList is not synchronized, meaning it's not safe for concurrent access by multiple threads. However, you can create a synchronized wrapper using the ArrayList.Synchronized() method. Syntax To check if an ArrayList is synchronized − bool isSync = arrayList.IsSynchronized; To create a synchronized ArrayList wrapper − ArrayList syncList = ArrayList.Synchronized(originalList); Return Value The IsSynchronized property returns a bool value: true if the ArrayList is synchronized (thread-safe) false if the ArrayList is ...

Read More

Get the TypeCode for value type UInt32 in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 205 Views

To get the TypeCode for value type UInt32 in C#, you can use the GetTypeCode() method. This method returns a TypeCode enumeration value that represents the data type of the current object. The UInt32 data type represents a 32-bit unsigned integer with values ranging from 0 to 4, 294, 967, 295. When you call GetTypeCode() on any uint variable, it returns TypeCode.UInt32. Syntax Following is the syntax for getting the TypeCode of a UInt32 value − TypeCode typeCode = uintVariable.GetTypeCode(); Return Value The GetTypeCode() method returns TypeCode.UInt32 for all uint variables, regardless ...

Read More

Insert an element into the ArrayList at the specified index in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 441 Views

The ArrayList.Insert() method in C# allows you to insert an element at a specific index position in an ArrayList. This method shifts all existing elements from the specified index to the right, making room for the new element. Syntax Following is the syntax for the Insert() method − arrayList.Insert(index, value); Parameters index − The zero-based index at which the new element should be inserted. value − The object to insert into the ArrayList. ArrayList Insert Operation ...

Read More

C# Program to Check If a Number is a Happy Number

AYUSH MISHRA
AYUSH MISHRA
Updated on 17-Mar-2026 8K+ Views

We are given a number as input, and we need to check whether it is a happy number or not. In this article, we will learn how to check if a number is a happy number using C#. What is a Happy Number? A happy number is a number that eventually becomes equal to 1 when we repeatedly replace it with the sum of the squares of its digits. If the number gets stuck in a cycle and never reaches 1, then it is not a happy number. Happy Number Process ...

Read More
Showing 10061–10070 of 61,299 articles
Advertisements