Code reusability is very important in the software development process. We can save time and resources and reduce redundancy by using the code that have already been written. Continue reading “Creating a class library with C# and .NET Core in Visual Studio Code and how to use in another project”
The following code snippet demonstrates that how can you create a short cut of any windows application executable programmitically using C#. Continue reading “Create shortcut of the executable programmatically using c#”
If you want to to create a text file and write the text and if the file already exist then just append the text in the new line using C#, you can use the following code snippet in c#. Continue reading “Create or open text file to write the text in c#”
A cookie is just a little bit of text which is send by the browser each time with the request for the page. Each time on the machine when browser will make the request to the web page, it will send the existing cookies along with the request too. So this approach helping the Web site or web application remember users and other information such as user’s preferences, shopping cart contents and the user’s session. Continue reading “Writing and reading cookies in ASP.net using c#”
In this article we will discuss about the files uploading in the asp.net. Asp.net provides the FileUpload control and you can use this with a small amount of code lines for uploading the documents. However there are many other ways to upload the files using the several jQuery,flash and Ajax plugins. In the following you can see a such a script that use the Ajax form plugin. Continue reading “JQuery multiple files upload in asp.net and C# using Ajax form”
The following example shows to keep the \r\n characters in the string after Serialization and Deserializtion.
Generally when you serialize an object with a string value that contains ‘\r\n\’ (Carriage Return and new line characters in string) and after deserialize it than in the outcome ‘\r’ is disappeared. Suppose if you string is ‘5 Avenue \r\n North road’, the string comes after deserialize as ‘5 Avenue \n North road’. Continue reading “Keep ‘\r\n’ in XML Serialization and Deserializtion in C#”
The following article demonstrates how to create new DataTable from the DataView or DefaultView of another DataTable. The general requirement for doing this is that once you have retrieved DataTable from a data source and than you may need to sort or filter the data without retrieving it again. You can use the ToTable() method that creates and returns a new DataTable object based on rows in an existing DefaultView of the DataTable. Continue reading “Create new DataTable from the DefaultView of the another DataTable”
In the past I have described some topics on the LINQ over XML such as: generate xml document with elements and attributes using linq to xml, create the xml document using linq to xml in c# and UPDATE THE XML FILE USING LINQ IN C#. This time we will perform some LINQ query over the ArrayList object in the C#. Continue reading “Example for LINQ Query to ArrayList in C#”
You can pad an integer with leading zeros by using the “D” string format specifier. You can pad integer, floating-point and negative numbers with leading zeros by using a “D” format string. Continue reading “Pad the value with leading zero using D format specifier in C#”
If you are working with the .Net framework 4.5, you can use the String.IsNullOrWhiteSpace Method to specify the string is null, empty, or consists only of white-space characters.
The following example contains the five string type variables, we pass the each variable into the IsNullOrWhiteSpace method to check whether a string is null, empty, or only contains the white-space characters. Continue reading “Check whether a string is null, empty, or only contains the white-space characters”