"NET MVC Enterprise Combat" (i) MVC Development Prelude

Source: Internet
Author: User

I. Tools and Methods

Learned some useless tools and methods:

A) remove redundant using directives and sort: the use of a class header is generally a lot less than that, and after writing the class, you can right-click the "organization using" to remove the useless using and sort.

Do not select to copy or delete a line of code: You can directly put the cursor in this line, directly to CTRL + C ctrl+x the entire line operation. Previously used Shift+delete is also a whole line cut.

Find matching Tags: in pairs appear tags such as {}, #region #endregion等, put the cursor on one of them, use CTRL +] can jump to the other half of the symbol, for the code length is very convenient for the occasion. Experiments are also available in HTML and JS code.

b) Httprequester

Used for testing interfaces, which can be used in WEBAPI development, to simulate various types of requests, and to customize the addition of request messages and request headers that need to be submitted.

Second, the new grammatical characteristics of c#2.0

A) generics (generics): Generics introduce the concept of a type parameter into. NET, where the existence of a type parameter allows the designation of a type to be deferred until the client code declares and instantiates the class or method. List<t> is the application of generics, and T is a placeholder for the type, which is executed when instantiated. The main advantage of generics is that type safety can be guaranteed at compile time, because there is a certain performance improvement without having to do type conversion.

b) generic delegate: If the Del delegate uses generics, the overloads of the Notify method can also be automatically recognized.

c) generic interface: This is not actually used yet.

d) generic method: If the return is also generic, plus a conversion involving generics, it is not guaranteed to succeed if it is converted to an object. It feels bad to control.


e) generic constraint: You can add constraints to generic parameters, and the types of constraints you can add are:

Wheret:struct Value Types

Wheret:class Reference Types

The wheret:new () parameter must have a public parameterless constructor

Wheret:<base class name> derived from a base class

Wheret:<interface name>> implements an interface

Wheret:u u is a type parameter and T derives from U

The notation is

f) partial class partial

The code can be published in different files, and WinForm and WebForm UI code and logic code use partial, and the final compilation will merge multiple parts together.

g) anonymous method

The nature of anonymous methods is also a delegate, which is a function-type programming. The most important feature of functional programming is the use of methods as parameters and return values. Since it is commissioned, you need to have a signature, anonymous method delCW2 than the regular delegation delCW1 write simple, and JS function similar to the wording, but still more trouble than JS.

Learning materials:ASP. NET MVC Enterprise-level combat by Jong Jongjun

ASP. NET MVC Enterprise Combat (i) MVC Development Prelude

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.