Scrigroup - Documente si articole

Username / Parola inexistente      

Home Documente Upload Resurse Alte limbi doc  

CATEGORII DOCUMENTE




loading...



AccessAdobe photoshopAlgoritmiAutocadBaze de dateCC sharp
CalculatoareCorel drawDot netExcelFox proFrontpageHardware
HtmlInternetJavaLinuxMatlabMs dosPascal
PhpPower pointRetele calculatoareSqlTutorialsWebdesignWindows
WordXml


The lock statement

C sharp

+ Font mai mare | - Font mai mic








DOCUMENTE SIMILARE

Trimite pe Messenger
Standard conversions
Operators - Operator precedence and associativity
Properties
Namespace and type names
Relational and type testing operators
Implicit conversions
Boxing and unboxing: Boxing conversions
Enums - declarations, Enums members
Selection statements
Interfaces - declarations, Interface members

The lock statement

The lock statement obtains the mutual-exclusion lock for a given object, executes a statement, and then releases the lock.




lock-statement:
lock ( expression ) embedded-statement

The expression of a lock statement must denote a value of a reference-type. An implicit boxing conversion (6.1.5) is never performed for the expression of a lock statement, and thus it is an error for the expression to denote a value of a value-type.

A lock statement of the form

lock (x)

where x is an expression of a reference-type, is precisely equivalent to

System.Threading.Monitor.Enter(x);
try
finally

except that x is only evaluated once. The Enter and Exit methods of the System.Threading.Monitor class are described in the CLR specification.

The System.Type object of a class can conveniently be used as the mutual-exclusion lock for static methods of the class. For example:

class Cache

}

public static void Remove(object x)
}
}



loading...







Politica de confidentialitate

DISTRIBUIE DOCUMENTUL

Comentarii


Vizualizari: 342
Importanta: rank

Comenteaza documentul:

Te rugam sa te autentifici sau sa iti faci cont pentru a putea comenta

Creaza cont nou

Termeni si conditii de utilizare | Contact
© SCRIGROUP 2020 . All rights reserved

Distribuie URL

Adauga cod HTML in site