how to identify dotnet version

Sometimes we may want to find out what .Net version we are using,

Here, is the solution

–> Environment.Version 

This gives the exact version of .NET running the application.

stored procedure vs function in sql server

Store Procedure
1.Store procedure may or may not return values.
2.Store procedure allow input/output parameters
3.Store procedure not allowed in where/Having/select sections anywhere in Sql statements
4.Procedure cann’t be called from the function

Function
1. Function must return the result values
2. Function only input parameters
3. Function can used in Sql Statement Having/Where/Select sections anywhere.
4. Function can return values so we can use joins in any other tables
5. Function can be called from the stored procedure

 

 

 

Difference between capacity and maxCapacity in StringBuilder

Case 1: StringBuiilder sb = new StringBuilder(2);

Here even though capacity is specified, the sb can store more items.
It doesn’t have any limit on numbers of items to be added.

Case 2 :

StringBuiilder sb = new StringBuilder(1,4)

Here, 1 is the capacity
and 4 is the maxcapacity

sb.Add(“1);
sb.Add(“12”);
sb.Add(“123”);
sb.Add(“1234”);
sb.Add(“12345”);  // throws an error as it exceeds maxcapacity

Only upto maxcapacity is allowed in this case.