. NET notes (2),. net notes

Source: Internet
Author: User

. NET notes (2),. net notes
Null merge Operator

?? The operator is called the null merge operator. If the left operand of this operator is not null, this operator returns the left operand; otherwise, the right operand is returned.

An error occurs when Average is used.

Because the data contains DBNull, it should be written

Decimal? AvgUPri = dt. AsEnumerable (). Average (q => q. Field <decimal?> ("Unit price "));
Ref, out

The out parameter is relatively simple. After the parameter is added, you do not need to declare the variable first.
Assertions

Do not place function calls in Debug. Assert statements. Use temporary variables

List

ArrayList // storage object, which requires packing when storing value-type data, which consumes a lot. An ArrayList can store different data types.
Generic

Advantages: algorithm reuse, type security, no binning compared to objects, and performance loss of Packing
Coordination and resistance to changes

Inverter:
Covariant:
Synchronous and asynchronous

Synchronous and asynchronous communication focuses on the message communication mechanism.

Synchronization: The caller takes the initiative to wait for the call results
Blocking non-blocking

Blocking and non-blocking focus on the status when the program is waiting for the call result (message, return value ).

Blocking: before the call result is returned, the caller suspends
Thread

Thread security considerations during foreach Loop

During foreach, do not try to remove or add the traversal set.

Any set, even if marked as thread-safe, will cause exceptions when adding or removing items during foreach.

Linq
from [type] id in source[join [type] id in source on expr equals expr [into subGroup]][from [type] id in source | let id = expr | where condition][orderby ordering,ordering,ordering...]select expr | group expr by key[into id query]

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.