Tag: dotnet

Initialize int array in C# ?

Here’s a code snippet demonstrating how to initialize int arrays in C# and display the contents of it using the for loop. How to Initialize int array in C# ?

C#.NET Interview Questions and Answers – Part 3

C#.NET Interview Questions and Answers – Part 3 21. What is the use of Nan values for double and float in C# ? Nan in C# is generally used to represent special values in .NET . For example , in Silverlight and WPF , the values double.Nan is generally used to represent the automatic values. 22. What is the difference between Double and decimal in…

How to Compare two arrays in C# ?

Two arrays can be compared in C# using the Enumerable.SequenceEqual method . The Enumerable.SequenceEqual method in C# returns a boolean value indicating if both the arrays are equal or not. How to Compare two arrays in C# ? Below is an example of comparison of two arrays in C# using the Enumerable.SequenceEqual method.

How to get the IP Address of the Local Machine using C# ?

You can get the IP address of the local machine or localhost using C# using the Dns class’s GetHostByName defined in the System.Net namespace. The Dns.GetHostByName returns the array of AddressList which contains the IP address . How to get the IP Address of the Local Machine using C# ? Below is the sample code snippet demonstrating the retrieval of the IP address of the…

How to sort an array using Comparator in C# ?

The Array.Sort method lets the developers pass the comparator which can be used to sort an array of objects. How to sort an array using Comparator in C# ? In the below example , the method CompareByName is used which lets the Array.Sort method to sort the array of objects in descending order.