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




About The Author

Suprotim Agarwal
Suprotim Agarwal, Developer Technologies MVP (Microsoft Most Valuable Professional) is the founder and contributor for DevCurry, DotNetCurry and SQLServerCurry. He is the Chief Editor of a Developer Magazine called DNC Magazine. He has also authored two Books - 51 Recipes using jQuery with ASP.NET Controls. and The Absolutely Awesome jQuery CookBook.

Follow him on twitter @suprotimagarwal.

2 comments:

AK said...

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


Slade Leonard said...

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