Tag: dotnet
How to find if the string is a number or not in C# ?
If you want to find out if the input string is a number in C# , you can use the try parse method. How to find if the string is a number or not in C# ? Below is a function in C# that demonstrates finding if the string is a number in C#.
Using String.Format method in C# to add commas in thousands place for a Number
If you need to add a comma in the thousands place for a number using the String.Format method in C# , you can use the format specifier N as shown in the below code snippet. Using String.Format method in C# to add commas in thousands place for a Number
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 Copy the entire contents of a directory in C# ?
Below is a sample code snippets that demonstrates how to copy the entire contents of a directory to another in C#. How to Copy the entire contents of a directory in C# ?
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 Save a Stream to a File in C# ?
Below is a sample code snippet that demonstrates how to save a stream to a file in C#. How to Save a Stream to a File in C# ?
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.