|
|
-
|
|
We all know that a protected member is accessible from within the class in which it is declared, and from within any class derived from the class that declared this member. Internal members are accessible only within files in the same assembly What abo......
|
|
-
|
|
While working with Generic Types, often we will face problems while initializing as Reference types need to be initialized as null and value types to be initialized to 0. For structs, it will initialize to each member. So, to initialize generic type var......
|
|
-
|
|
.Net 4.0 gave us a lot of tools to make parallelization easier with PLINQ. Parallelization can help increase program performance tremendously, and it gives us the ability to run more than one thread in parallel.
[code]
Parallel.Invoke
[/code]
Para......
|
|
-
|
|
Data paging becomes easier in LINQ. With the help of Take() and Skip() methods, it is so easy to implement paging.
[code]
private IList<Employee> GetEmployees(int startingPageIndex, int pageSize)
{
using (BWDataContext context = new BWDat......
|
|
-
|
|
When doing math comparisons between two numeric values where one of them may be a null Nullable<T>, consider using the System.Nullable.Compare<T>() method instead of the comparison operators. It will treat null less than any value, and will......
|
|
-
|
|
C# 3.0 introduced the concept of extension methods. By using this feature, we can add various utility methods to the CLR types. few times, in our application we wants to check whether the value entered by user is numeric or not. Here is an example of ad......
|
|
-
|
|
While browsing Scott Gu's website, found this. Nuget is a free, opensource package management system for .Net platform, which simplifies the process of incorporating various third party libraries into .net application. It offers a lot of packages, you c......
|
|
-
|
|
C# 3.0 introduced the new concept of object initializers, which makes easy to create objects.Before c# 3.0, we used
to create an object like this
Old syntax :
[code]
Person person = new Person();
person.FirstName = "Scott";
person.LastName =......
|
|
-
|
|
If a type is boxed, while unboxing, it should be unboxed to same type. Otherwise, it throws an invalid cast error.
Below code will generate an error, since we are boxing an interger and then unboxing to float.
[code]
int i = 1;
......
|
|
-
|
|
In ASP.NET, master/content pages are used to maintain unique style across website. In MVC3 framework, Razor view engine came up with concept of site layout pages to maintain consistent look and feel across a website.
Initially, we will design a Mast......
|
|