A simple Exception Handling example – C Sharp/C#
Hi, As you know an exception is an error that occurs during the runtime. Here is a simple exception handling example using C Sharp/C#. using System; class MainClass{ public static void Main(){ int...
View ArticleSort 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. using System;...
View ArticleHow to replace a substring in C Sharp/C# ?
Hi, For replacing a substring in C Sharp/C#, use the following lines of code. using System; class Class1 { static void Main(string[] args) { string newStr = "Heaven"; string finalStr = "CoderzWorld";...
View ArticleArticle 6
Hi, Use the following simple lines of code to check whether a particular file exists or not using C#/C Sharp. using System; using System.IO; static class MainClass { static void Main(string[] args) {...
View ArticleProgram to reverse the digits of a number in C Sharp/C#
Hi, Use the following code if you want to reverse the digits of a number using C Sharp/C #. using System; class MainClass { public static void Main() { int urNum; int urdigits; urNum = 123;...
View ArticleGet characters in a string – C Sharp/C#
Hi, Sometimes you may need to get all the characters in a string using C Sharp/C#. The following code gives you an example of how to get or display all the characters of a given string. using System;...
View ArticleConversion from String to Double using C#
Hi, Sometimes you may need to convert string to double using C#, see the following lines of code to see how you could do it. class MainClass { static void Main() { string myString = " 3.14159"; double...
View ArticleHow to Check if File Exists in C Sharp/C# ?
Hi, Use the following simple lines of code to check whether a particular file exists or not using C#/C Sharp. using System; using System.IO; static class MainClass { static void Main(string[] args) {...
View ArticleUploading Files to Server in C#/C-Sharp
Hi, For uploading files to server in C#/C Sharp, <%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="UploadFile" %> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML...
View ArticleHow to upload files to server using the new FileUpload control in C#/C-Sharp ?
Hi, For uploading files to server using the new FileUpload control in C#, <%@ Page Language="C#"%> <script runat="server"> protected void Button1_Click(object sender, EventArgs e) { if...
View Article