I have been graduating from. Net for several years, and I think I can only be proficient, not proficient. So, Let's sum up on the. NET development technologies that you have mastered. net in the end. Let's take a look at the shortcomings.
1. Familiar with common net framework APIs. Some APIs may need to be used in combination with multiple types.
Ientity2 clonedentity =Null; Binaryformatter formatter =NewBinaryformatter ();Using(Memorystream memstream =NewMemorystream () {formatter. serialize (memstream, sourceentity); memstream. Seek (0, seekorigin. Begin); clonedentity = (ientity2) formatter. deserialize (memstream );}
This example is the implementation of. Net Deep copy. There are many examples like this. The combined applications of these Apis need to be mastered. After accumulation, you usually have your own utility database.
2 LINQ to object. Although LINQ to SQL has been abandoned and forgotten, LINQ to object is a very important technology. Without this technologyCodeIt will be filled with foreach, which is not easy to maintain, and many codes are routine code, which can be omitted.
String [] Names = { "Tom" , "Dick" , "Harry" , "Mary" , "Jay" }; Ienumerable < String > Query = from N In Names Where N. Contains ( "" ) // Filter elements Orderby N. Length // Sort Elements Select N. toupper (); // Project each element Foreach ( String Name In Query) console. Write (name + "/" );
At the same time, the technical Lambda technology that works with LINQ can simplify a lot of code, which also needs to be mastered. The above example is rewritten using Lambda technology.
String[] Names = {"Tom","Dick","Harry","Mary","Jay"}; Ienumerable <String> Query = names. Where (n => N. Contains (""). Orderby (n => N. Length). Select (n => N. toupper ());Foreach(StringNameInQuery) console. Write (name +"|");
Once there was a very popular exam question, examining the three ways of writing a delegate, as shown in the following example:
List int List = New List int (); list. addrange ( New int [] {1, 5, 10, 20, 33 }); // use the traditional delegate syntax to call findall predicate int callback = New predicate int (isevennumber ); list int evennumbers = List. findall (callback ); // use the anonymous method List int evennumbers = List. findall ( DeleGate ( int I) { return (I % 2) = 0 ;}); // use lambda expressions List int evennumbers = List. findall (I => (I % 2) = 0); (the Code comes from the road to LINQ 3: C #3.0 language functions (below) )
3. Net 4 introduces a new parallel programming library. Unlike multithreading, this technology is used to adapt to the multi-core era. Let's take a look at the example belowProgram
static double parallelpi () { double sum = 0.0; double step = 1.0/( double ) num_steps; Object monitor = New Object (); parallel. for (0, num_steps, () = & gt; 0.0, (I, state, local) >{< SPAN class = "kwrd"> double X = (I + 0.5) * step; return Local + 4.0/(1.0 + x * X );}, local =>{ lock (MONITOR) sum + = Local ;}); return step * sum ;}
With a new Lambda expression, this example is not hard to understand. This is the value of PI in the parallel library.
. Net 4 also introduced a dynamic language, as shown in the following example, Python example
scriptruntime py = python. createruntime (); // dynamic feature only works on objects typed as 'dynamic' dynamic helloworld = py. usefile ( "helloworld. PY "); console. writeline ( "helloworld. PY loaded! "); for ( int I = 0; I <1000; I ++) {console. writeline (helloworld. welcome ( "Employee # {0}" ), I );} // Python code def welcome (name ): return "hello" + name + "'from ironpython"
To improve the performance of the. NET program, you can consider using the. NET Parallel library. If you are looking for a scripting language, you can host it in. Net for convenient calling. The Python here should be a good start. For. net Framework directly built-in technology, there will certainly be a large number of third-party tools, products to enhancement or extension for it, you can find a very good tool, for your project to increase flexibility and improve performance.
4. Orm development technology. You can select nhib.pdf or Entity Framework. Orm technology allows your code to focus on business logic, greatly simplifying coding and debugging of data access code. In addition, The ORM technical support interface and logic separation, strong data binding, these benefits can increase flexibility for your project. For example, you can save your code and write it Using ORM technology.
Using(Dataaccessadapterbase adapter = getdataaccessadapter ()){Try{Adapter. starttransaction (isolationlevel. readcommitted,"Savecustomer"); Adapter. saveentity (customer,True,False); Adapter. Commit ();}Catch{Adapter. rollback ();Throw;}}
You can not underestimate these statements. First, it is generated using the code generator. Second, you do not need to make any changes to the database fields for adding and modifying the database fields, the changes in the interface and business logic will not affect this. With these benefits, you can save a lot of time and focus on your business logic.
5. Distributed communication technology .. Net remoting and WCF, at least one must be mastered.
6. Interface package .. Although the interface control provided by the net framework is simple and easy to use, it is not powerful enough. Therefore, we recommend that you purchase a set of popular interface controls to make your project readable. Although it is said that the interface is not important and the logic is important, we also understand that the interface looks terrible, and the best logic and architecture will not be accepted by the customer. The interface should be simple and practical, and easy to start. There are many controls available here, including infragistics, syncfusion, and componentone, which are all well-known control vendors.