Friday, 27 February 2015

What is difference between string and stringbuilder?

String:

                 String is immutable, Immutable means if you create string object then you cannot modify it and It always create new object of string type in memory.

          Example

String objStr = "Sting Value";
// To create a new string instance instead of changing the old.
objStr = objStr + "Value1";
objStr = objStr + "
Value11"; 

String Builder:

                StringBuilder is mutable, means if create string builder object then you can perform any operation like insert, replace or append without creating new instance for every time.it will update string at one place in memory doesn't create new space in memory.

          Example

StringBuilder objStrBul = new StringBuilder("");
objStrBul .Append("Hello.!!");
objStrBul .Append("HowAreYou? ");
String objStr  = objStrBul.ToString();

What's the difference between .js and .min.js?


  1. Functionality wise both are same. The only difference is .min.js is the compressed version of .js.
  2. If you are working on development machine then you should use .js.
  3. Whereas in production or where your web site is hosted you should use .min.js file. It will decrease page load-time for your webpage using that.

MVC Redirect One Controller to another Controller

 return RedirectToAction("MethodName", "ControllerName");

Monday, 23 February 2015

what is inproc and outproc?

In-proc session mode:

1. session data is stored in current application domain and so consumes memory of server machine.

2. if server restarts, all session data is lost.

Out-proc mode (which is generally state server):

1. session data is stored on state server and so web servers memory is not consumed.

2. in case of web server restart, session data is preserved.