Tag: .NET
Verbatim String Literals in C#
C# supports Verbatim String literals which begin with @ followed by the string data and doesn’t have a escape sequences within the string. This might be specially useful when you want to represent the file path . Below is a representation of Verbatim String Literals in C#
Example of Immediate Query Execution of LINQ in C# .NET
Below is a sample code snippet that demonstrates the Immediate Query execution of LINQ Query in C#. Example of Immediate Query Execution of LINQ in C# .NET The Output of the above program in
How to Create Extension Method in C# ?
Extension methods are great way to add a method to an existing type . A typical scenario is when you dont have the access to the sourcecode and want to add a method to the type . How to Create Extension Method in C# ? Below is a sample code snippet that demonstrates how to create an extension method for the integer type to tell…
NoSQL Solutions for .NET
Below are list of some the popular NoSQL Solutions available for .NET applications. db4o Redis MemcacheDB RavenDB Lucene.net MongoDB
How to generate a random number in C# and .NET?
If you want to generate a random number in your .NET application using C#, you can use the random class to generate one. How to generate a random number in C# and .NET? Below is a sample code snippet on how to generate random numbers in C#. Try to keep the instance of the Random class and reuse it Incase you are generating more than…
How to Decode HTML Characters in C# ?
The .NET Framework 4.0 and above provides the WebUtility.HtmlDecode class which lets the developers to convert the string which are encoded with HTML characters to plain string . How to Decode HTML Characters in C# ? Below is a sample code snippet that demonstrates how to decode HTML characters in C#.
What are the Different Access Modifiers available in .NET?
There are 5 different access modifiers available in .NET Public – The members declared as public is accessible to all. Private – The members declared as private is accessible only within the same type. Internal – The members declared as internal is accessible only with in the same assembly. Protected – The members declared as protected is accessible to the same type or inherited type….
Example of deferred execution of LINQ Query in C# .NET
Below is a sample code snippet that demonstrates the deferred execution of LINQ Query in C#. Example of deferred execution of LINQ Query in C# .NET The Output of the above program is
Top Tools to Convert HTML to PDF in .NET
There are times when you may want to generate PDF from the simple HTML data . There are plenty of tools available that lets the developers to easily convert HTML to PDF in .NET . Below are some of the well known tools to perform the task. Top Tools to Convert HTML to PDF in .NET wkhtmltopdf A simple shell utility tool that lets the…
Difference between Hash table and Dictionary in .NET
Here’s a simple difference between Hashtable and Dictionary in .NET Dictionary Hashtable It is generic in nature It is non generic in nature It is defined in the namespace System.Collections.Generic It is defined in the namespace System.Collections When a request is made to the dictionary and if the key does not exists , you get an exception When a request is made to the Hashtable…
Namespace in C#
A Namespace in .NET is used to organize your code . The Namespace provides a better code readability and helps you understand how the code is arranged . They help you to organize large projects very well. The Namespace is also used to distinguish classes with same same . The Namespace can be nested into another namespace and is references with the keyword “using”. using…
What are the Advantages of the ASP.NET MVC Framework ?
ASP.NET MVC has some advantages over the traditional ASP.NET Web Forms development . In this article , we will have a look at some of the advantages of the ASP.NET MVC Framework . What are the Advantages of the ASP.NET MVC Framework ? SoC – Separation of Concerns Separation of Concern is one of the core advantages of ASP.NET MVC . The MVC framework provides…
How to convert a string to integer in C# ?
You can convert a string to integer in C# using the following functions 1. Int32.Parse / int.Parse 2. Convert.ToInt32 3. Int.TryParse() How to convert a string to integer in C# ? Below is a sample sourcecode demonstrating the usage of the above functions The advantage of using the int.tryparse is that when the string (str) in the above example is a invalid number , a…
How to Convert a Stream to Byte Array in C# 4.0 ?
One of the simplest way to convert a stream to byte array in C# 4.0 is to use the MemoryStream and perform the CopyTo operation on the source stream to the Memory Stream. How to Convert a Stream to Byte Array in C# 4.0 ? Below is a sample code snippet on how to convert a stream to byte array in C# 4.0.
Popular LINQ Providers for .NET Developers
LINQ stands for Language Integrated Query . It enables the developers or the programmers to query against different data sources with the similar syntax. Below are some of the popular LINQ Providers for the .NET Developers. Popular LINQ Providers for .NET Developers Linq to Excel Linq to Google LINQ to Active Directory LINQ to AD LINQ to JavaScript linq.js – LINQ for JavaScript LINQtoCRM LINQ…