C# Tips

Get Latest C# Tips and .Net Tips over here. This tips are very helpful.

.Net Tips : Remove leading and trailing white spaces from string using Regex with C#.Net and VB.Net example

It is very easy to remove string's leading and trailing white spaces using Regex. Read More...

Wednesday, 25 June 2014

Remove only trailing white spaces from string using Regex with C#.Net and VB.Net example

It is very easy to remove string's trailing white space using regex. Here is example for this. Read More...

Wednesday, 18 June 2014

Remove only leading white spaces from string using Regex with C#.Net and VB.Net example

It is very easy to remove string's leading white space using regex. Here is example for this. Read More...

Wednesday, 12 February 2014

.Net Tips : Convert DataTable object to list of class object using LINQ with C#.Net and VB.Net example

You can fill List of object from DataTable using LINQ. Here is example on this. Read More...

Thursday, 16 January 2014

.Net Tips : Attach and Raise events on XML document object with C#.Net and VB.Net example

You can attach events to XML document objects. These events raise on adding or removing XML element in XML document object. Read More...

Friday, 20 December 2013

C# Tips : Validate or Verify XML File Data using LINQ and REGEX with C#.Net and VB.Net example

There is a very easy way to validate XML file Data using LINQ and display result. Here is example for this. Read More...

Wednesday, 11 December 2013


Wednesday, 20 November 2013

C# Tips : Sort or order by Date in XML File data using LINQ with C#.Net and VB.Net example

We can sort data of XML file base on Elements that contains different type of data like date, etc. Here is example for this. Read More...

Wednesday, 16 October 2013

C# Tips : LINQ SelectMany Method C#.Net and VB.Net example

Here is very useful way to implement SelectMany LINQ method in code. Read More...

Thursday, 26 September 2013

C# Tips : Get Full Path of XML Node using LINQ with C#.Net and VB.Net example

We can get full or whole path of given XML Node or Element using LINQ Read More...

Wednesday, 11 September 2013

C# Tips : Get XML Element of particular position from XML Document using LINQ positional predicate with C#.Net and VB.Net example

LINQ positional predicate is used for query XML Element of particular position. Here is C#.Net example and VB.Net example for this. Read More...

Monday, 9 September 2013

MVC Tips : Uploads and Downloads files in ASP.Net MVC

There are very easy way to upload and download files in MVC. Here are the steps and download-able example. Read More...

Monday, 26 August 2013


Monday, 19 August 2013

RegularExpression Validation using Annotations in ASP.Net MVC framework

In MVC we can do string regular expression validation easily. We can also set custom error message as validation message. Read More...

Monday, 12 August 2013

Abstract Factory Design Pattern In ASP.Net With C# and VB.Net Example

Abstract Factory Design Pattern is use for software creations. Learn Abstract Factory Design Pattern in ASP.Net With Examples. Read More...

Monday, 29 July 2013


Tuesday, 23 July 2013

String Length Validation using Annotations in ASP.Net MVC framework

In MVC we can do string length validation easily. We can apply Maximum and Minimum Length to field in controller using data annotations attribute. Read More...

Monday, 15 July 2013

Get all attributes and it's value from XML file using LINQ with C#.Net Example and VB.Net Example

We can get specific attributes and it's values from XML file or document or object using LINQ very easily. Read More...

Tuesday, 9 July 2013

Required Field Validation using Annotations in ASP.Net MVC framework

We ca do validation using data annotations in ASP.Net MVC framework. View detail article and downloadable example here. Read More...

Saturday, 29 June 2013

Factory Method Design Pattern In ASP.Net With C# and VB.Net Example

Factory method design pattern is very useful in software creation. Factory method design pattern is a creational design pattern. Read More...

Tuesday, 18 June 2013

.Net Tips : Create or Generate XML file programmatically using XElement and XAttribute class with C#.Net and VB.Net example

It is very easy to create XML file programmatically using XElement and XAttribute class. Look at here the example. Read More...

Tuesday, 11 June 2013

.Net Tips : Add XML declaration programmatically to a XML document in .Net with C#.Net and VB.Net example

We can add XML declaration to a XML document programmatically and able to create XML document. Read More...

Wednesday, 5 June 2013

.Net Tips : Create XElement or XML from string

We can parse or construct or create XML or XElement from string. Read More...

Friday, 31 May 2013

.Net Tips : LINQ SkipWhile Method Example With C#.Net and VB.Net

SkipWhile LINQ method to return the elements of the array starting from our given condition matched. Read More...

Wednesday, 22 May 2013

.Net Tips : Check sequence of elements in two arrays are equal or not using LINQ With C#.Net and VB.Net Example

You can check that two array has the same sequence of element or not. We are using "SequenceEqual" LINQ method. Read More...

Thursday, 23 May 2013

.Net Tips : LINQ TakeWhile Method Example With C#.Net and VB.Net

You can get element from array until your given condition is satisfied using TakeWhile LINQ method. Read More...

Tuesday, 14 May 2013

.Net Tips: Check that particular word or string part contains in string array using LINQ "Any" method With C#.Net and VB.Net Examples

We can check that particular word or string part contains in string array without iteration using LINQ "Any" method. Read More...

Wednesday, 8 May 2013

.Net Tips: Convert two dimensional array in to Dictionary object using LINQ With C#.Net and VB.Net Examples

You can convert array in to dictionary object using "ToDictionary" LINQ method. Here is example for this. Read More...

Thursday, 2 May 2013

Get only specific type of value from array which contains many types of values from object array using LINQ With C#.Net and VB.Net Examples

We can get specific type of Objects from array of object using using LINQ's "OfType" generic method. Here is example for this. Read More...

Saturday, 6 April 2013

Make dropdown list auto complete or searchable or filtering using JQuery with ASP.Net Dropdownlist Control

We can make Auto Complete and some fancy look Dropdownlist using javascript and JQuery plug-in. Here is article for Auto Complete and some fancy look ASP.Net Dropdownlist control. Read More...

Saturday, 30 March 2013

CRUD Operation in ASP.NET Web API with Example.

This articles demonstrate how we can implement ASP.Net WebAPI in live scenario like Insert, Update, Delete , CRUD Operation. In this article we demonstrate step by step with Customer Management Page. Read More...

Friday, 8 March 2013

Create First ASP.Net Web API Project Step By Step

New ASP.Net Web API Framework released by Microsoft. This Web API uses to serve data in Mobile, Tablet, Desktop, Browsers and other client in HTTP format. Read More...

Tuesday, 19 February 2013

Image slide show using JQuery With ASP.Net Example

Now a day image slide show is very popular in websites. Earlier we are using Flash for image slide show. But now a days we are using Javascript for making lite weight image slide show. Using JQuery we can make image slide shows with a many variations in slide show. Read More...

Thursday, 7 February 2013

Simple email validation without validation control in ASP.NET 4.5 and HTML 5 in TextBox control

New feature in ASP.Net 4.5. HTML5 introduces new data types which also support by ASP.NET 4.5 textbox control. For email validation you do not require any validation controls. We need to just set property of textbox and input type control. Read More...

Wednesday, 27 February 2013

Get formatted date time string from date time object in asp.net

You can get and display formatted date time in asp.net. We are using .ToString() method of date time object to get formatted date time string. Read More...

Friday, 1 February 2013

Mapping a File Extension in IIS for HTTP Handler file with C# Examples and VB.Net Examples

Http Handler using ".ashx" file extension and this is very convenient and understandable to all of us. But we can also custom this file extension with our requirement. To make customization in file extension we need to do add class file in "App_Code" folder and this class file implement "IHttpHandler" interface. And also mapping file extension in IIS and add settings in "web.config" file. Read More...

Tuesday, 29 January 2013

Lifecycle of an HTTP message in ASP.NET Web API

This Image shows how an HTTP request flows through the Web API pipeline, and how the HTTP response arrive back. It has also shows extensibility points, where we can add custom code or even replace the default behavior entirely. Read More...

Friday, 25 January 2013

New Strongly Typed Data Controls introduce in .Net 4.5 with C# Examples and VB.Net Examples

Strongly Typed Data Controls features newly introduce in vNext series. New ItemType Property for controls who has "template" Concept like Repeater, Grid, Form View etc.. Strongly typed data-controls is a small, but very good feature that makes work with data bound expressions easier and cleaner. Read More...

Saturday, 19 January 2013

New Object Caching Option Introduce in .Net 4.0 with C# Examples and VB.Net Examples

Before .Net 4.0 we are using System.Web.Caching.Cache object. Now in .Net 4.0 introduce same system.web.caching functionality in System.Runtime.Caching.dll everything was rebuilt into the new namespace of System.Runtime.Caching. Here is Example for this. Read More...

Wednesday, 9 January 2013

Short Term Storage Using HttpContext.Current.Items is asp.net's best secret

ASP.NET’s best kept secrets is The Items collection of HttpContext. This is an IDictionary key/value collection of objects that’s shared and access across the life of a single HttpRequest. This short term storage because it stores data in single HttpRequest. Read More...

Tuesday, 1 January 2013

Get Image from Generic HTTP Handler file by implementing HttpHandler interface with C# Examples and VB.Net Examples

HttpHandlers is different from HttpModules. HttpHandlers positions in the request-processing pipeline is different from HttpModules. Using HttpHandlers we can map to a specific file extension. Handlers are the final stop for incoming HTTP requests and the point in the request processing pipeline that is responsible for serving the requested content or data like. HTML , ASPX page, plain text, or an image. Read More...

Monday, 24 December 2012

Image Overlay Using JQuery Plugin With ASP.Net Example

Using Image overlay we can provide more details regarding image on mouse hover of image. This overlay is common in modern websites. We are using JQuery Image Overlay Plugin. This is a javascript file which you found online as well as we place this javascript in our example so you can download that from our given asp.net example. Read More...

Wednesday, 7 November 2012

Unable to raise server side click event of button using "onClientClick" in Rad AjaxPanel

There is a situation where you want to put asp button in telerik Rad AjaxPanel and execute some javascript function using "onClientClick" event and base on that javascript function you need to execute server side code Read More...

Monday, 29 October 2012

Create and Handle Custom Exception Class in your application in .Net with C# Examples and VB.Net Examples

There is a situations where you need to create and handle a custom exception for handling runtime’s exception for application-specific exceptions. In this example we provide both C#.Net Example and VB.Net Example. Let's look how this mechanism works. For that we need to create a serializable class that extends the System.Exception class, and ass some constructors and properties to manipulate the data members. Read More...

Friday, 19 October 2012

Retrieve or Get only integer values from mixed values of string array or generic string List using LINQ

This is a situations where you have an string array which contains some string element or values and some integer values and we want to parse that integer values from that List or array and retrieve only integer values. Read More...

Monday, 15 October 2012

Implement IComparable interface to compare objects with C# Examples and VB.Net Examples and Sample

You can compare two object of same class with your predefine rules. You can also say comparison between two objects. You can provide compare custom types with your predefined business rules. This also allow to sort collections of instances of those types. Read More...

Monday, 1 October 2012

Implement ICloneable Interface with C# Examples and VB.Net Examples

There is a need where you wan to clone an object for your custom requirement you need to "ICloneable" Interface and Implement Clone() Method, the inbuilt Clone() method does not fulfill custom requirement. Read More...

Friday, 28 September 2012

Set Holidays or Note on particular date in asp calendar control with C# Examples and VB.Net Examples

You can set holidays or note on particular date in calendar control. For that we are using "DayRender" Event of the calendar control. Read More...

Wednesday, 26 September 2012

Select entire month or entire week using selection mode in calendar control with C# Examples and VB.Net Examples

You can select entire week or month in asp.net calendar control and get it's selected dates. You can achieve using SelectionMode property of calendar control. Selection mode property has an enum and it has four selection mode like Day , DayWeek , DayWeekMonth and None. Read More...

Monday, 24 September 2012

Process or Read the Content of an Atom or RSS Feed with C# Examples and VB.Net Examples

You can process the content of an Atom 1.0 or RSS 2.0 feed to extract or get details of the feed. .Net framework provide classes to parse the feed data. We are using System.ServiceModel.Syndication.SyndicationFeedFormatter and System.ServiceModel.Syndication.SyndicationFeed classes. Read More...

Tuesday, 18 September 2012

Simple sticky menu using Javascript and JQuery

Now a days sticky menu is most popular menu in websites. You can generate sticky menu using JQuery and some CSS classes. You are able to working menu in out downloadable samples. In this example we integrate sticky menu into aspx page. Read More...

Thursday, 13 September 2012

Create Custom LINQ Extension Methods in VB.Net

You can create your own custom LINQ extension method in .Net Application. These extension methods are very handy in software development. Creating a LINQ extension method in VB.Net has Different approach than C#.Net . Read More...

Tuesday, 11 September 2012

Binary Deserialization with C# Examples and VB.Net Examples

Binary Deserialization is a reverse process of Binary Serialization. In Binary Deserialization we fetch binary file that generated from Binary Serialization and get back origional object. Read More...

Tuesday, 11 September 2012

Binary Deserialization with C# Examples and VB.Net Examples

Binary Deserialization is a reverse process of Binary Serialization. In Binary Deserialization we fetch binary file that generated from Binary Serialization and get back origional object. Read More...

Monday, 10 September 2012

Serialize object and store in file using Binary Serialization with C# Examples and VB.Net Examples

There is a need to serialize object and store into a file, and then deserialize when required. For Binary Serialization we are using "BinaryFormatter" class which is available in "System.Runtime.Serialization.Formatters.Binary" namespace. Read More...

Friday, 7 September 2012

Beginning .Net , C# Tips : Create Custom LINQ Extension Methods with C# Examples

There is a need to create a custom LINQ extension method in .Net Application. This is a very good .Net Framework feature. These extension methods are very handy in software development. For that we need to create Static Class and Static Methods. Read More...

Thursday, 6 September 2012

Concatenate or Combine LINQ query Results or DataSources with C# Examples and VB.Net Examples

There is a situations where you want to Concatenate Or Combine one or more data sources using LINQ. With the help of the Concat<> extension method to concatenate or combine multiple sources into a single data source. Read More...

Tuesday, 4 September 2012

Convert from IEnumerable<> to Dictionary object using LINQ with C# Examples and VB.Net Examples

There is a situations where you need to convert LINQ result or IEnumerable<> object into Dictionary object. This is possible with the help of the LINQ Extension methods. Read More...

Monday, 3 September 2012

Get or Retrieve stored file from SQL Server Database Table with C# Examples and VB.Net Examples

You can retrieve stored file from SQL Server Database Table and store as physical file in hard drive. Read More...

Thursday, 30 August 2012

XML Deserialization with C# Examples and VB.Net Examples

In XML Deserialization you convert XML file data back in to custom class objects. This is a reverse process of XML Serialization. Read More...

Wednesday, 29 August 2012

XML Serialization of Class Objects with C# Examples and VB.Net Examples

There is a need where you want objects data into XML format. You can achieve this using XML Serialization. Using XML Serialization you can convert custom objects data into XML and XML into custom objects. Read More...

Tuesday, 28 August 2012

Insert or Save file into SQL Server Database Table with C# Examples and VB.Net Examples

There is a need in application to upload a file and store into SQL Server Database table. You can do this very simple way. File is stored in sql server as binary data. You need to set "varbinary" data type of the column in which you want to store file. You need to take "varbinary(MAX)" data type. Read More...

Monday, 27 August 2012

Parse and create URL with C# Examples and VB.Net Examples

There is always a need to parse and create valid URL. We can achieve this using "Uri" class's "TryCreate" method. Here is example for this. Read More...

Thursday, 23 August 2012

beginning .net : set maximum characters allowed for Single Line and Multi Line Textbox in .Net

There is always a need of application to set maximum length allowed in textbox. In this article we demonstrate both single line textbox and multi line textbox max length validation. There is a different way to set maximum characters allowed for single line textbox and multiline textbox. Read More...

Wednesday, 22 August 2012

Write an Event Entry in Windows Event Log

You can write or insert entry in to the Windows event log using the static methods of the EventLog class, or also you can create an EventLog object. But you must decide in which event source you want to write your log entry.The event source is a string that uniquely identifies your application. Read More...

Tuesday, 21 August 2012

.Net Tips : Password Encryption in .Net with C# Examples and VB.Net Examples

For security purpose there is a need to convert plain string in cryptographic string or encrypt password, so hackers did not understand the password. You can create cryptographic string using seven different algorithms, That provided in .Net Framework. Read More...

Monday, 20 August 2012

Hashing algorithms in .Net Framework

Hashing algorithms are one way cryptographic functions that accept plain text of any length and generate a numeric value. These are one-way because it̢۪s almost impossible to get the original plain text from the hash code. Hashing algorithms are useful for encrypt the password. Read More...

Friday, 17 August 2012

Handling errors using Custom Errors configuration settings in web.config

When error occurred in .Net application Asp.Net page display it's default error page with the source code and line number of the error. This approach is not good it has some issues like. Read More...

Thursday, 16 August 2012

Object cannot be cast from DBNull to other types Error

This error occurred due to cast or convert or assign NULL value cell of data row or data table.
Error Reason : Here is example for this. We have datatable. This data table contains value of cusutomers, thsi data table has three columns. Read More...

Thursday, 9 August 2012

Read event logs and display with C# Examples and VB.Net Examples

You are able to reading event log from .Net application. We are using "EventLog" class of "System.Diagnostics" namespace. There are three categories of event log available Application, Security and System. Read More...

Wednesday, 8 August 2012

List of server configuration files in .Net

Every ASP.NET server includes a number of configuration files, such as the machine.config , web.config file. This file is installed as a default .NET Framework installation. Read More...

Tuesday, 7 August 2012

Beginning .Net , C# Tips : Get number of processors on the machine

You can get processors count on your machine. We are using "ProcessorCount" property of "System.Environment" class. Read More...

Monday, 6 August 2012

C# Tips : Find or Discover all SQL Server Instances on Local Area Network (LAN)

We can get all SQL server instances of our Local Network (LAN). We are using GetDataSources method of the System.Data.Sql.SqlDataSourceEnumerator class. Read More...

Saturday, 4 August 2012

C# Tips : Union or combine Two LINQ query Results with C# Examples and VB.Net Examples

You can union of two LINQ query or Results. You can also say combine records from two LINQ query or Results. We are using "Union" method of LINQ. In this example we combine or union records from two DataTable using LINQ. Read More...

Wednesday, 1 August 2012

C# Tips : Get Operating System name and version details of server with C# Examples and VB.Net Examples

You can get Operation System (OS) name and major version and minor version details,service pack and build details of server using "System.Environment" class. We can use OSVersion property of Environment Class which will return "OperatingSystem" class. Read More...

Tuesday, 31 July 2012

C# Tips : Get IP Address from host name with C# Examples and VB.Net Examples

You can get IP Address of a fully qualified host name. We can Use GetHostEntry method of the System.Net.Dns class. There are multiple IP Addresses for some host name. Read More...

Monday, 30 July 2012

Create a well formed URI using UriBuilder class with C# Examples and VB.Net Examples

You can use System.UriBuilder class to build a new well-formed URI. You can also say create a well-formed URL. You need to set some property of UriBuilder object's , like Scheme , Port , Host , Path etc.... Read More...

Friday, 27 July 2012

Get list of all files of directory or folder using LINQ using .Net Framework 4 with C# Examples and VB.Net Examples

You can get list of all files in particular directory or folder and it's all sub directories. .NET Framework 4 allow to enumerate directories and files using methods that returns enumerable collections. Read More...

Tuesday, 24 July 2012

.Net Tip : Intersect or find common records of Two LINQ queries with C# Examples and VB.Net Examples

You can get Intersect of two LINQ query or Results. Intersect means find common records between two LINQ results. Here is example of this. Read More...

Monday, 23 July 2012

.Net Tip , C# Tip : Copy one stream to another stream Using CopyTo Method with C# Examples and VB.Net Examples

.NET Framework 4 introduce new "CopyTo" method of Stream Class of System.IO namespace. Using this method we can copy one stream to another stream of different stream class. Read More...

Thursday, 19 July 2012

.Net Tip , C# Tip : Create XML File using XmlWriter and save with C# Examples and VB.Net Examples

You can create a XML File using XMLWriter class. XMLWriter class available in System.XML namespace. This will give proper indentation and create Well formed XML File. Read More...

Tuesday, 17 July 2012

C# Tip : Get System Folder Path using C# Examples and VB.Net Examples

You can get System Folder path using code using "System.Environment" Class. We are using Static / Shared "GetFolderPath" method of Environment Class. Here is examples of this. Read More...

Friday, 13 July 2012

.Net Tips , C# Tip : Check file contents is changed using calculate and comparing hash code of a file

Hash code of a file is useful for check that file contents is changed over the time or not. First time you calculate hash code of a file and store , after some time period you again calculate hash code of a file and compare with stored hash code, If hash code is changed that means contents of the file is changed. Read More...

Thursday, 12 July 2012

.Net Tips : Ping an IP Address or Website using C# Examples and VB.Net Examples

Ping message is sent using the ICMP using System.Net.NetworkInformation.Ping class. Ping Message passing a test packet to specific IP Address, and requests the remote device respond by send back the packet. In Ping Message a byte array of up to 65,500 data bytes that is sent with the ping request and that should be returned back in the response. Read More...

Wednesday, 11 July 2012

.Net Tips : Execute or Perform LINQ query on DataTable Or DataSet

You can execute LINQ query on DataTable Or Specific table on DataSet with the help of the AsEnumerable. Read More...

Tuesday, 10 July 2012

.Net Tips : Check is process is 64-bit process in .Net Framework 4

You can check that your current application uses in 64 bit process or not. In .NET Framework 4 there is one function Is64BitProcessis available to check that current application uses in 64 bit process or not. Read More...

Friday, 6 July 2012

.Net Tips : Create a Cryptographic Random Number with C# Examples and VB.Net Examples

We can generate cryptographic random number using RNGCryptoServiceProvider class. This class is available in System.Security.Cryptography namespace. The System.Random class is a random number generator , the algorithm it uses is deterministic, meaning that you can always calculate what the next number will be based on the previously generated number. Read More...

Thursday, 5 July 2012

.Net Tips , C# tip : Read and Processing XML file with an Xdocument with C# Examples and VB.Net Examples

XDocument is Introduce in System.Xml.Linq namespace. XDocument is more friendlier and easy to use than XMLDocument. Earlier we are using XMLDocument for read and processing XML File. Syntax of retrieving element from XML document is different than XMLDocument. Read More...

Wednesday, 4 July 2012

.Net Tips : new Clear Method Introduce in StringBuilder Class in .Net Framework 4 with C# Examples and VB.Net Examples

In .NET Framework 4 New Method introduce in StringBuilder class. Method name is "Clear". This method helps you to clear or remove values or data from String Builder object's. In earlier version of .Net , If you want to remove values or data from string builder object's for next use , at that time you want to set Length Property to Zero. Read More...

Tuesday, 3 July 2012

.Net Tips : Read XML File With an XMLReader with C# Examples and VB.Net Examples

XmlReader provides fast, forward-only, read-only access to XML documents. These documents may contain various elements in multiple namespaces. XmlTextReader and XmlNodeReader classes derive from XMLReader and work as an abstract class for these classes. Read More...

Friday, 29 June 2012

.Net Tips : Identify whether the current operating system is a 64-bit operating system in .Net Framework 4

You can determine that the current operating system is 64 bit OS or not. In .NET Framework 4 there is one function Is64BitOperatingSystem is available to check that current operating system is a 64-bit operating system. This function available in Environment class of System namespace. Read More...

Thursday, 28 June 2012

.Net Tips : Validate GUID string and Improvement in GUID in .Net Framework 4

In .NET Framework 4 there is enhancement System.Guid structure, These includes new TryParse and TryParseExact methods. GUID means a globally unique identifier (GUID). GUID is a structure and it's namespace is System.Guid. A GUID is a 128-bit integer this can be used in all computers and networks wherever a unique identifier is required. Read More...

Wednesday, 27 June 2012

.Net Tips : Get Time Span between two dates using TimeSpan Class

In .NET Framework 4 there is enhancement in TimeSpan Class, These include new overloads of the ToString , TryParse and Parse methods, and also introduce new methods like TryParseExact and ParseExact. Using time span class you get time span interval between two dates, this timespan gets in days , hour , minute , seconds and milliseconds format. .Net Beginners very much like this type of example. Read More...

Tuesday, 26 June 2012

.Net Tips : New Tuple class in .Net Framework 4

The .NET Framework 4 intorduce the System.Tuple class for creating tuple objects that contain structured data. It also provides generic tuple classes to support tuples that have from one to eight components . To support tuple objects that have more than 8 components, there is a generic tuple class with seven type parameters and an eighth parameter of any tuple type. Read More...

Friday, 22 June 2012

.Net Beginners , C# Tips : Optional and Named Parameters in C#

.Net 4.0 Framework provide Optional and Named Parameters in C# also. Previously it was supported in VB.Net. Now you do not need to write unnecessary overload methods , With the help of the Optional method you can achieve this. Read More...

Thursday, 21 June 2012

C# Tips : Create database connection string using ConnectionStringBuilder

You can create database connection string using ConnectionStringBuilder class. You can use the System.Data.Common.DbConnectionStringBuilder class or one of its strongly typed subclasses that form part of an ADO.NET data provider. Here is the list of available DbConnectionStringBuilder implementations for standard data providers: Read More...

Wednesday, 20 June 2012

How to connect database using C#.Net and VB.Net

You need to open a connection to a database on regular bases for database operations. For that you need to create a connection object. The IDbConnection interface represents a database connection, and each data provider implement interface uniquely. Here is the list of some IDbConnection implementations for standard data providers: Read More...

Tuesday, 19 June 2012

Read file with FileStream using Read method in C# .Net Programming and VB.Net Programming

You can read file byte data using "Read" Method of FileStream class and get bytes array. You can also say that read bytes array from FileStream object or read bytes array from FILE. Here are example of this. Read More...

Thursday, 14 June 2012

Append or Write the data to a text file

There is a very quick way to open text file and appends data into that file. There are two methods to appends text files AppendAllText and AppendAllLines. These methods open a file. Appends data to the files , and then close the file. If file does not exist, These methods create the files , appends the data and close the file. Read More...

Wednesday, 13 June 2012

Compress and Decompress file or data using C# and VB.Net

.Net framework provide the System.IO.Compression.GZipStream or System.IO.Compression.DeflateStream to compress or decompress data. Both GZipStream and DeflateStream classes allow you to use ZIP and Deflate compression algorithms to compress or decompress data. Read More...

Tuesday, 12 June 2012

Locate specific lines within the Text file Using LINQ

You can also query the text file using LINQ . Here are example for this. In this example we can get specific lines which has matching word given by us. After the LINQ query is executed you need to close file otherwise it gives error on next attempt to access of file. Read More...

Saturday, 9 June 2012

Get common values from two arrays using LINQ

Using LINQ you are able to fin common values amoung two arrays. There is a one method "Intersect" in LINQ to get intersect values. Here are sample example for this. Read More...

Friday, 8 June 2012

Generate XML File from Dataset

You can generate XML file from Dataset very easily. Here are sample example for this. In this example we have one dataset name "products" and one table inside dataset name "product". Read More...

Thursday, 7 June 2012

C# Programming : Group Join Using LINQ in LINQ To Objects

Using a group join you can get group wise data using LINQ. Here are sample example for this. In this example there are two classes Books and Publishers. Now we want to display Publisher wise books, One publishers has multiple books. We can do this using LINQ. Using a group join you can get all the publishers that match a books as a sequence. Read More...

Wednesday, 6 June 2012

C# Tips : Sort an array using LINQ

Using LINQyou are able to sort array. Array may contains integer , string , double or char values. Here are sample example for this. Read More...

Tuesday, 5 June 2012

Left Outer Join Using LINQ in LINQ To Objects

You can also do left outer join using LINQ. Here are sample example of this. In this example there is book class which has PublisherId field , this fields contains only numeric values. Read More...

Monday, 4 June 2012

C# Tips : Join in XML Data files Using LINQ Query in LINQ to XML

Using LINQ to XML you can also join multiple files and get result based on LINQquery. LINQ to XML uses System.Xml.Linq namespace. Here are example for this Read More...

Saturday, 2 June 2012

C# Tips : Querying the array using LINQ and LAMBDA Expression 

You can also query the array variables using LINQ.
Here are sample example for this.
In this example there is an array of integer values which contains various number, Now we want to get numbers in array which is greater then 5. Read More...

Wednesday, 30 May 2012

Querying the XML data file using LINQ in LINQ to XML

Using LINQ to XML we can use the same basic LINQ syntax to query XML documents. LINQ to XML uses System.Xml.Linq namespace. Here are example for this. Read More...

Tuesday, 29 May 2012

Paging Query Using LINQ

Using LINQ we can achive paging logic in your application much easier by exposing the Skip and Take methods. The Skip method enables you to skip a defined number of records in the resultset. Read More...

Monday, 28 May 2012

Joining using LINQ in LINQ To Objects

LINQ also supports the joining of data from different collections using a familiar SQL-like join syntax. Here are sample example of this. Read More...

Friday, 25 May 2012

Different LINQ operators in LINQ To Objects

LINQ also includes many operators you can execute on enumerable objects. Most of these operators are available to use and are similar to operators that you find in SQL, such as Count, Min, Max, Average, and Sum. Read More...

Thursday, 24 May 2012

Grouping data using a LINQ query In LINQ To Objects

You can also perform Grouping in LINQ to Objects using a LINQ Query. This LINQ query uses the group keyword to group the Books data by pages. Read More...

Wednesday, 23 May 2012

Simple filter query with LINQ To Objects

You always need to filter the records based on certain fileds. Using LINQ query you are able to get this. Here are sample example for that. Read More...

Tuesday, 22 May 2012

Linq delayed execution behavior

An interesting feature of LINQ is its delayed execution behavior. Means that even though you may execute the query statements at a specific point in your code, LINQ is smart enough to delay the actual execution of the query until it is accessed. Read More...

Monday, 21 May 2012

Data ordering and custom field name using LINQ To Objects

You can also set data ordering and custom field name using linq query. Here are sample example for that. Read More...

Thursday, 17 May 2012

Get selected fields LINQ query using LINQ To Objects

There are situations where you do not want all fields in LINQ query you want only selected fields. You can also say that Creating a custom projection with LINQ. Read More...

Wednesday, 16 May 2012

Simple query with LINQ To Objects

Now a days LINQ is more popular for query. We can also query to object using LINQ. Read More...

Tuesday, 15 May 2012

Upload file on FTP server using c#

You are able to upload a file on FTP server from your application. Using FtpWebRequest and FtpWebResponse classes executing File Transfer Protocol (FTP) commands from your Web page easy. Read More...

Monday, 14 May 2012

Download file from FTP server and save using c#

You are able to download file from FTP server and save to your desire location using .Net Using FtpWebRequest and FtpWebResponse classes executing File Transfer Protocol (FTP) commands from your Web page easy. Using these classes, implementing an entire FTP client right from your Web application is now possible. Read More...

Friday, 11 May 2012

Post data to remote server or URL in C# Programming

There are situations where you want to post data to remote server and other external URL. We can do this using System.Net namespace. Read More...

Thursday, 10 May 2012

Simple Screen Scrap using c# and vb.net

Screen scrapping means to get other sites data from given URL. You can do this using the HttpWebRequest and HttpWebResponse classes to screen scrape, you can use the following code to build a Web page that will serve as a simple Web browser. You also learn how to display another Web page inside of yours using an HttpWebRequest. Read More...

Wednesday, 9 May 2012

Reading contents of a MemoryMappedFile

Using streams does have a couple problems that might encounter in certain scenarios. Read More...

Tuesday, 8 May 2012

Fill dropdownlist from Enum

There are a situations where you want to fill dropdownlist of listbox using Enum. Here are sample example for this. Read More...

Monday, 7 May 2012

Make First Letter of each word capital

There is a situation where you need to capital first letter of each word. You can also say that Title Case to string. Here are useful code snippets for this. Read More...

Saturday, 5 May 2012

Encodings in StreamReader

The StreamReader by default attempts to determine the encoding format of the file. If one of the supported encodings such as UTF-8 or UNICODE is detected, it is used. If the encoding is not recognized,the default encoding of UTF-8 is used. Depending on the constructor you call, you can change the default encoding used and optionally turn off encoding detection. Read More...

Thursday, 3 May 2012

Get multiple selected items from listbox using LINQ

If you want to get multiple selected items from listbox without using FOR loop using LINQ you can achieve that. Read More...

Wednesday, 2 May 2012

Convert List of Object's Value to List of Integer in C# Programming

There are many situations where you want to convert List<Object>'s Value to List<int>. Using Linq Method ConvertAll we can achieve in one sentence. LINQ Namespace is System.Linq.  Read More...

Monday, 30 April 2012

Convert List of Integer to List of String

There are many situations where you want to convert List<int> to List<string>. Using Linq Method "ConvertAll" we can achieve in one sentence. LINQ Namespace is System.Linq.  Read More...

Saturday, 28 April 2012

Reading and writing binary data in C# Programming

Now use the BinaryReader and BinaryWriter classes to read and write primitive types to a file.The BinaryWriter writes primitive objects in their native format, so in order to read them using the BinaryReader, you must select the appropriate Read method. Read More...

Friday, 27 April 2012

Reading and writing a text file with a StreamReader in C# Programming

StreamReader and StreamWriter classes to write a string to a text file and then read the contents of that text file. Read More...

Thursday, 26 April 2012

http://jayeshsorathia.blogspot.com/2012/04/c-tips-write-to-memorystream-in-c.html

There is a situation where you want to write data in Memory Stream. You can write to the stream by encoding a string containing the information you want to write to a byte array and then using the stream̢۪s Write method to write the byte array to the MemoryStreams. Read More...

Tuesday, 24 April 2012

Read a file using FileStream in C# Programming

There are many times you want to read text file. There are many ways to read files. One way is to use FileStream class. Here are sample example to read the file and display it's content on page. Read More...

Monday, 23 April 2012

Removing Rules to Access Control List on File and Directory using C# Programming

To remove rule you can use RemoveAccessRule methods. Here are sample Example. Read More...

Saturday, 21 April 2012

Adding a Rules to Access Control List on File and Directory using C# Programming

There is a situations where you want to modify the ACL lists. In this example, you give a specific user explicit Full Control rights over the file. You can use either an existing user or create a new test User account . Read More...

Friday, 20 April 2012

C# Tips : New string.IsNullOrWhiteSpace inbuilt methods in .net 4.0

There are situations in which you need to check that string is null or Empty or only space in string exist or not. Previously we have string.IsNullOrEmpty Method. Read More...

Thursday, 19 April 2012

Get Access Control List of File and Directory using C# Programming

There is a need to get the Access Control Lists or ACLs on directories and files. ACLs are the way resources such as directories and files are secured in the NTFS file system,which is the file system used by most recent versions of Windows. Read More...

Wednesday, 18 April 2012

Working with Path Class using C# Programming

.NET Framework provides you with a class for working with file paths. The System .IO.Path class has many static methods to work with paths. Read More...

Tuesday, 17 April 2012

Set and Get current directory in .Net

When an ASP.NET page is executed, the thread used to execute the code that generates the page by default has a current working directory of that page. It uses this directory as its base directory . If you pass a relative filename into any System.IO class, the file is assumed to be located relative to the current working directory. Read More...

Monday, 16 April 2012

Get list of files from directory programmatically using .Net

Sometimes we want list of files and its details like file name , size , last access time etc... of a directory programmatically. We can achieve this using DirectoryInfo and FileInfo Class. These classes are available in available in System.IO Namespace. Read More...

Thursday, 12 April 2012

Get Directory Information programmatically using .Net

Some time you want to get directory information like sub directories , last access time , last write time , Create new directory in to parent directory etc... programmatically using .Net. Read More...

Monday, 9 April 2012

http://jayeshsorathia.blogspot.com/2012/04/beginning-net-call-overloaded-method.html

Some time you need to call single or overloaded method using reflection. Here are sample example for that : Read More...

Wednesday, 4 April 2012

Get System Drive info programmatically using .Net

You can get Drive info using DriveInfo class. DriveInfo class available in System.IO Namespace. You can get details like name, type, size, and status etc... of each drive. Read More...

Tuesday, 20 March 2012

"Thread was being aborted." Error occurred due to Response.End, Response.Redirect, or Server.Transfer method methods

When you are using Response.End, Response.Redirect, or Server.Transfer method methods in Try Catch Block it will throw "ThreadAbortException" Exception. Error Message like "Thread was being aborted." Read More...

Saturday, 25 February 2012

How to get virtual path of web application ?

Getting the virtual paths local to server using this syntax. Read More...

No comments:

Post a Comment