Где искать: по сайтам Запорожской области, статьи, видео ролики
пример: покупка автомобиля в Запорожье
https://art-of-engineer.blogspot.com/2021/06/statements-in-c.html
c# tutorial | statements in c#
Lets check out the various types of statements in C#.
The actions that a program takes are expressed in statements.
Common actions include declaring variables, assigning values, calling methods, looping through collections, and branching to one or another block of code, depending on a given condition.
A statement can consist of a single line of code that ends in a semicolon, or a series of single-line statements in a block.
A statement block is enclosed in flower brackets and can contain nested blocks.
Now lets take a look at the various types of statements in C#.
The following code shows examples of variable declarations.
One without initial assignment.
And one with initial assignment.
The following code shows example of expression statement.
Method invocation statements and object creation statements are also treated as expression
Statements.
Selection statements enable you to branch to different sections of code, depending on one or more specified conditions.
Examples include if else statements. switch statements. and case statements.
Iteration statements enable you to loop through collections like arrays, or perform the same set of statements repeatedly until a specified condition is met.
Examples are for, foreach and while statements.
Jump statements transfer control to another section of code.
Some examples are break. And return statement.
Exception handling statements enable you to gracefully recover from exceptional conditions that occur at run time.
C# statements can execute in either checked or unchecked context. In a checked context, arithmetic overflow raises an exception. In an unchecked context, arithmetic overflow is ignored and the result is truncated by discarding any high-order bits that don’t fit in the destination type.
If you mark a method with the async modifier, you can use the await operator in the method. When control reaches an await expression in the async method, control returns to the caller, and progress in the method is suspended until the awaited task completes.
An iterator performs a custom iteration over a collection, such as a list or an array. An iterator uses the yield return statement to return each element one at a time.
The fixed statement prevents the garbage collector from relocating a movable variable. The fixed statement is only permitted in an unsafe context.
The lock statement acquires the mutual-exclusion lock for a given object, executes a statement block, and then releases the lock. While a lock is held, the thread that holds the lock can again acquire and release the lock. Any other thread is blocked from acquiring the lock and waits until the lock is released.
You can give a statement a label and then use the goto keyword to jump to the labeled statement.
And finally, The empty statement consists of a single semicolon. It does nothing and can be used in places where a statement is required but no action needs to be performed.