lundi 8 mars 2021

Check if code is inside using block via reflection

I'm trying to figure out if I can check if a code is inside a using block, and what is the value initiated by the using block... something like code below (I used SqlConnection just as an example)

using(var connection = new SqlConnection())
{
    var con = GetConnectionFromUsingBlock();
}

I know something like this is used by the TransactionScope, but I do not know how it is done. Any Help?





Aucun commentaire:

Enregistrer un commentaire