Category Archives: C#.NET

Hi, Use the following simple lines of code to check whether a particular file exists or not using C#/C Sharp. It will return either True or False depending on whether your file exists or not. ๐Ÿ™‚

Sort elements in a String Array – C Sharp / C#

Hi, In order to sort the elements in a string array in C Sharp/C#, we use the sort() method. Given below is a simple example using sort() method to sort the elements in a string array. It will print out, Sorted string Array: urStringArray[0] = apple urStringArray[1] = coderz urStringArray[2] = heaven123 urStringArray[3] = heaven777โ€ฆ Read More »

Program to generate Fibonacci series in C Sharp/C#

Hi, Here is a simple program to generate Fibonacci series using C Sharp /C#. It will generate Fibonacci numbers < 100. [csharp] class MainClass { public static void Main() { int oldNum = 1; int presentNum = 1; int nextNum; System.Console.Write(presentNum + ","); while (presentNum < 100) { System.Console.Write(presentNum + ","); nextNum = presentNum +โ€ฆ Read More »

How to find a leap year using C# ?

Hi, Sometimes you may need to find whether a particular year is leap year or not. But how can you find out whether a particular year is leap year or not in C# ? Use the following code. And the output is, Is the year 2011 a leap year ? = False ๐Ÿ™‚