Random ASP.NET, MVC & C# Tips in 100 Chars




I had a lot of fun last Friday! The South Asia Microsoft MVP group had organized a Techweet Friday where Microsoft MVP’s would tweet tips about different Microsoft Technologies in 100 chars or less.

I tweeted too and here are some ASP.NET, ASP.NET MVC and C# tips for my non-twitter friends

C# Tips

Once you assign a value to a BigInteger variable, it becomes immutable (cannot change)

'var' is not really a C# keyword. You can name variables & parameters as “var” and your compiler won't complain

Enum does not mean Enumerator. Enum is a custom data type whereas Enumerator is a class implementing IEnumerable

Did you know that enum types cannot be written generically. Only classes, interfaces & delegates can be

You should design all custom attributes as sealed .GetValues(typeof(SomeEnum))){ }


Delegates are immutable, so doing del += CallMethod creates a new delegate instance

ASP.NET & MVC Tips

Although Razor view engine is for ASP.NET MVC development, it can also be used in ASP.NET 4.5 web form development

Did you know the entire code for ASP.NET MVC, Web API, and Web Pages Frameworks can be d/l at codeplex (http://aspnetwebstack.codeplex.com/)

To open a Visual Studio 2012 upgraded project in Visual Studio 2010, you need to install Service Pack 1

Use the MonoDevelop IDE for building .NET apps using the Mono platform for Mac OSX or Linux OS 

Although the System.Net.Http library was introduced in .NET 4.5, Web API apps can use in .NET 4.0 too

To make an ASP.NET MVC WebAPI call on a different server using JSONP, use the JsonpMediaTypeFormatter

To construct urls for ASP.NET Web API controllers, use the Url property of System.Web.Http.Routing.UrlHelper

To improve compilation speed in ASP.NET VS 2010, add this to web.config - <compilation optimizeCompilations="true">

HTTP Compression only compresses Response Body. Headers & Cookies aren't compressed unless done manually.

On a Production site, a new URL rewrite rule will restart your site as the web.config gets updated

Getting a 503 Service Unavailable error? In addition to IIS Concurrent Request, also check http.sys limit

Will you give this article a +1 ? Thanks in advance




About The Author

Suprotim Agarwal, ASP.NET Architecture MVP works as an Architect Consultant and provides consultancy on how to design and develop Web applications.

Suprotim is also the founder and primary contributor to DevCurry, DotNetCurry and SQLServerCurry. He has also written an EBook 51 Recipes using jQuery with ASP.NET Controls.

Follow him on twitter @suprotimagarwal

comments

2 Responses to "Random ASP.NET, MVC & C# Tips in 100 Chars"
  1. Anoj Kumar said...
    February 27, 2013 at 2:12 AM

    Thanks for your valuable tips. Link (http://aspnetwebstack.codeplex.com/) is not working as because of typo.


  2. Slade Leonard said...
    April 2, 2013 at 5:07 AM

    C# language is provide delegate features in asp.net to developed application easily.

 

Copyright © 2009-2014 All Rights Reserved for DevCurry.com by Suprotim Agarwal | Terms and Conditions