c#3.0 New Experience (i)

Source: Internet
Author: User
Tags expression

Preface Overview:

Microsoft's footsteps have been very fast, often found that a lot of technology has not yet learned is outdated (may be my ability to learn); As the research and development of personal thought should stand in the forefront of technology, must keep up with the footsteps of new technology (no way, do not learn these things, over a period of time to lose their jobs);

Starting from 2002 to do development, has been used in Vs.net (C #), can be counted on the use of. NET, an old programmer, but looking back, incredibly to. NET a lot of do not understand, or is a smattering of; (Sweat like a fountain) as a use of 5, 6 years. NET development programmer, incredibly only know the page puts control to be neat good-looking, the UI data passes to the business layer processing, then invokes the data layer to visit (the work main processing content), for a long time did not know asp.net why Thing (formerly has been doing WinForm), the development uses most original The. NET IDE tools that started with. No auxiliary tools to develop, no concept of architectural design, project management do not know how to start, testing all rely on manual point interface, performance optimization has no effect, data transactions are not guaranteed, installation and deployment never know how to do, code refactoring has not been done, the design mode only know factory ......

There are too many things to understand, (ellipsis contains too much content) These two years just beginning to contact ASP.net development, a person stones, took a lot of detours, to now still groping, feel a lot of basic things are new; in the case of their ability to be extremely skeptical, but also to Microsoft (including, of course, other web Technical supplier) These cows produce extreme indignation, nothing to do so much technology, let me how to live (poor ability, lazy type), learn a technology (point) and n+1 in the back row;

These two years busy decorate, marry daughter-in-law (all is lazy excuse), the original a bit of technical accumulation of the past is outdated, many are not used, directly leading to a serious consequence: the last two years did not raise wages, but also beware of the problem of unemployment (borns ah, there are all the evils of bank loans oppression), under many pressures, decided to reinvent , a new person, for an early release of the sentence, tnnd, should be said to wash their hands (save a Xiang, of course, to calculate the U.S. dollar just line, this social RMB does not flower), so, decided to learn from the basics, began this c#3.0 process, hope that the collation of this information can give you a little help!

A. C # 3.0 Language main enhancement point

• Implicitly typed Local variables

• Extension methods

• Object and collection initializers

• Anonymous Type

lambda expression

• Query expression (LINQ)

• Expression tree

Two. Implicitly typed local variables

First take a look at the example:

var i = 5;
var h=23.56;
var s = “C Sharp";
var intArr = new[] {1,2,3,4} ;
var a = new[] { 1, 10, 100, 1000 };

"var" keyword is not very familiar, JavaScript often used (learn from each other now more common), of course, C # var and javascript in the Var difference is still relatively large.

1.var can only be used as a local variable;

That is, var can only be defined in a method, or in a foreach,for,using statement:

public class VarTest
{
private void test()
{
var i = 0;
}
}

Related Article

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.