C # ten minutes a day basis gossip series of four. Expression (lower)

Expression: this consists of the operator.
Operand: text, fields, variables, expressions

Static class: the program will start running occupation of memory.
Non-static: each instantiated once they take up memory, instantiated multiple times can cause excessive memory consumption.

await the operator to suspend evaluate a closed async method, until the asynchronous operation is completed operand indicates it.
async modifier: method, lambda expression or anonymous method can be specified as asynchronous.
Asynchronous Programming: Async and Await
Await modifiers: non-blocking way to start the task, when the current task is not finished, continue to perform other tasks.
async single-threaded and multithreaded Await difference:
open multiple threads = a lot of tasks, a lot of people do a lot of things at the same time. Some cook, some dishes.
Await = async and many tasks themselves to do more things at the same time. Own cooking time, go free dishes.
Single-threaded: a lot of tasks to do things one by one. Cooking for himself, not cooked meals, never to wash the dishes.

The Task class: Namespace System.Threading.Tasks;
Task class: no return value, a single operation performed asynchronously.
Task categories: execute on a thread pool asynchronous execution, not in the application thread.
Thread Pool: A multi-threaded processing forms.
Thread: minimum unit operating system operation scheduling.

Task.WhenAll (): Upon completion of all tasks provided to create the task. That is, the task completion of the enumeration in the collection.
await Task.WhenAll (eggsTask, baconTask, toastTask , staffTast, roomTask);

Task.WhenAny (): Upon completion of all tasks provided to create the task.
AllTasks new new System.Collections.Generic.List = {var heightAndwidthTask, addUCTask, write_message};
the while (allTasks.Any ()) {
the Task Finished = the await Task.WhenAny (AllTasks);
allTasks.Remove (Finished);
}

One yuan & operator: Returns the address of the operand.
& Operator: variable operands must be fixed.

  • Pointer indirection operator: acquisition variable pointer which points to the type of operand. Nickname: dereference operator.
    true and false operators: true operator returns true values bool operator necessarily true.
    false bool operator returns the value true, some operand is false.
    ... range operator: start and end of the specified range of indexes as an operand.

* Multiplication operator: the product of the number of calculation operations.
* One yuan operator: a pointer indirection operator.
/ Division operator: left operand is divided by the right operand.
I% Number of operators: the left operand is divided by the right operand.
Operators + Addition: Calculation and operands.
- subtraction operator: left operand subtracts the right operand;
<< left-shift operators: the left operand to the left operand bits rightward movement defined.

Right shift operators: the left operand digits to the right moves to the right defined.
<< and >> shift operators: the left operand is not negative, the high-order vacancy is 0. 1. negative number
<less than operators: the left operand is less than right operand, returns true, otherwise it is false;
greater-than operator: left operand is greater than right operand, returns true, otherwise it is false;
<= less than or equal to operator: left operand is less than or equal to right operand, returns true, contrary to false;
= greater than or equal to operator: left operand is greater than or equal to right operand, returns true, contrary to false;
== equality operators: the left operand is equal to right operand, returns true, contrary to false;
= no equality operators:! left-hand operand is not equal to right operand, returns true, contrary to false;
&& logical AND operator conditions : the number of logical operations. All results is true, it is true, otherwise it is to false;
|| conditions or logical operators: or logical operands, the result is a true, it is true, otherwise it is to false;
?? and ?? = null combined operation Fu: left operand is not empty, the left return operation result, on the contrary, returns the result of the operation right.
?: Ternary operator: based on Boolean expressions to select returns one result.
a b:? c as a result of a true, returns the result b, on the contrary, the results returned c.
ref conditional expression: An expression which returns a reference to the results.
= Assignment operator: assign the right operand to the left operand.
+ = Operator: the right operand to the left operand incremented once.
- = operator: the right operand to the left operand is subtracted once.
* = Operator: the right operand to the left operand is multiplied once.
/ = Operator: the right operand to the left operand in addition to a.
% = Operator: the right to the left operand operations take the remainder.

Right binding operation: = ?? null value assignment operator merge operator conditional operator?:

Published 130 original articles · won praise 36 · views 10000 +

Guess you like

Origin blog.csdn.net/weixin_44548307/article/details/104446378