Server Side Programming Articles

Page 848 of 2109

Extracting MAC address using C#

karthikeya Boyini
karthikeya Boyini
Updated on 17-Mar-2026 4K+ Views

A MAC address (Media Access Control address) is a unique identifier assigned to network interfaces for communications at the data link layer of a network segment. It serves as a network address for most IEEE 802 network technologies, including Ethernet, Wi-Fi, and Bluetooth. In C#, you can extract MAC addresses using the NetworkInterface class from the System.Net.NetworkInformation namespace. This class provides methods to enumerate all network interfaces on the local computer and retrieve their physical addresses. Syntax Following is the syntax for getting all network interfaces − NetworkInterface[] interfaces = NetworkInterface.GetAllNetworkInterfaces(); Following is ...

Read More

C# program to implement FizzBuzz

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

The FizzBuzz problem is a classic programming exercise that involves printing numbers from 1 to 100 with specific replacements. If a number is divisible by 3, print "Fizz". If divisible by 5, print "Buzz". If divisible by both 3 and 5, print "FizzBuzz". Otherwise, print the number itself. This problem tests your understanding of conditional statements, loops, and the modulo operator in C#. Syntax The modulo operator % is used to check divisibility − if (number % divisor == 0) { // number is divisible by divisor } The logical ...

Read More

Validate IP Address in C#

Arjun Thakur
Arjun Thakur
Updated on 17-Mar-2026 2K+ Views

An IP Address is an Internet Protocol address that is a series of numbers assigned to each device on a computer network. In C#, the IPAddress class in the System.Net namespace provides methods to work with and validate IP addresses. There are several approaches to validate IP addresses in C#, including using the built-in IPAddress.TryParse() method and regular expressions for custom validation. Syntax Following is the syntax for using IPAddress.TryParse() method − bool IPAddress.TryParse(string ipString, out IPAddress address) Parameters ipString − A string that contains an IP address in dotted-decimal notation ...

Read More

C# program to perform Quick sort using Recursion

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

Quick Sort is a highly efficient sorting algorithm that uses the divide and conquer approach. It selects a pivot element from the array and partitions the other elements into two sub-arrays according to whether they are less than or greater than the pivot. The sub-arrays are then recursively sorted. The algorithm works by placing the pivot in its correct position and then recursively applying the same process to the left and right sub-arrays until the entire array is sorted. How Quick Sort Works Quick Sort Process Initial Array: ...

Read More

How to perform Merge Sort using C#?

Arjun Thakur
Arjun Thakur
Updated on 17-Mar-2026 2K+ Views

Merge Sort is a sorting algorithm that uses the divide and conquer method. It divides the array into two halves, recursively sorts each half, and then merges them back together in sorted order. This process continues until the entire array is sorted. How Merge Sort Works Merge Sort follows these steps − Divide: Split the array into two halves at the middle point Conquer: Recursively sort both halves Merge: Combine the two sorted halves into a single sorted array Merge Sort Divide and Conquer ...

Read More

How to multiply a given number by 2 using Bitwise Operators in C#?

Ankith Reddy
Ankith Reddy
Updated on 17-Mar-2026 4K+ Views

A number can be multiplied by 2 using bitwise operators. This is done by using the left shift operator (

Read More

Char.IsUpper() Method in C#

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

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 More

Byte.Equals(Byte) Method in C#

AmitDiwan
AmitDiwan
Updated on 17-Mar-2026 368 Views

The Byte.Equals(Byte) method in C# returns a value indicating whether this instance and a specified Byte object represent the same value. This method provides a reliable way to compare two byte values for equality. Syntax Following is the syntax − public bool Equals(byte obj); Parameters obj − A byte object to compare to this instance. Return Value Returns true if obj has the same value as this instance; otherwise, false. Using Byte.Equals() for Value Comparison Example using System; public class Demo { public static ...

Read More

Dictionary.ContainsKey() Method in C#

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

The Dictionary.ContainsKey() method in C# checks whether the Dictionary contains the specified key. This method returns true if the key exists, otherwise false. Syntax public bool ContainsKey(TKey key); Parameters key − The key to locate in the dictionary. Cannot be null for reference types. Return Value Returns true if the dictionary contains an element with the specified key; otherwise, false. Using ContainsKey() to Check for Existing Keys This example demonstrates checking for a key that exists in the dictionary − using System; using System.Collections.Generic; public class Demo ...

Read More

Dictionary.ContainsValue() Method in C#

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

The Dictionary.ContainsValue() method in C# is used to check whether the Dictionary contains a specific value or not. This method returns true if the value is found in the dictionary, otherwise it returns false. Syntax public bool ContainsValue(TValue val); Parameters val − The value to search for in the dictionary. This parameter can be null if the value type allows null values. Return Value Returns true if the dictionary contains the specified value; otherwise, false. Using ContainsValue() with Found Value The following example demonstrates checking for a value that exists ...

Read More
Showing 8471–8480 of 21,090 articles
« Prev 1 846 847 848 849 850 2109 Next »
Advertisements