Example for LINQ Query to ArrayList in C#

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#”

Pad the value with leading zero using D format specifier 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#”

Check whether a string is null, empty, or only contains the white-space characters

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”

Click event of a Button on Click event of another button in C#

The following code example demonstrates how to call the Click event of a Button on Click event of another button. The following code assumes that two Button and one TextBox controls have been instantiated on a form. On the click of the button1, we will generate the click event of the button2 if the the value of the textbox1 is numeric. Continue reading “Click event of a Button on Click event of another button in C#”

How to show Indian currency symbol in MVC WebGrid

is the new Indian Rupee currency sign.it was presented to the public by the Government of India on 15 July 2010. When you try to show ₹ currnecy symbol using Culture and UCulture, you get the default currency symbol ‘Rs’ not ₹ then you need to set customize the symbol. Same problem occurs when you want to show this symbol in WebGrid in MVC projects. Continue reading “How to show Indian currency symbol in MVC WebGrid”

Generate xml document with elements and attributes using LINQ to XML

To generate a XML document with elements and attributes is easy by using LINQ to XML. LINQ to XML provides the XDocument, XElement and XAttribute classes,with the help of XElement class we can create XML content and create a new XML file using the XDocument class. Continue reading “Generate xml document with elements and attributes using LINQ to XML”

Create the XML document using LINQ to XML in C#

XML document is widely used file in the projects where we can store the small or big data such as configuration settings or last used data on the form. .Net framework provides various way to create the XML files (such as DataSet.WriteXML), but my concern it is so easy to create the XML document by using the LINQ to XML. Continue reading “Create the XML document using LINQ to XML in C#”

Using int.TryParse() within a LINQ where clause

I pretty new to LINQ, and I’m keen to get more experience using it, so whenever an opportunity arises I like to try writing LINQ queries. I needed to write a method to extract a comma separated list of numbers from a config file, and return this as List. Continue reading “Using int.TryParse() within a LINQ where clause”