c# - Determine if method is unsafe via reflection -


I see a way to filter out methods that have unsafe through reflection Modifier is It does not seem to be a method specialty.

Is there any way?

Edit: It seems that this information is not in the metadata, at least I can not see it in IL. Although reflector unsafe modifier shows in C # view.

Edit 2: I ended up with an inquiry for my needs, it believes that if any of the parameters of the method or return type is an indicator, Then the method is unsafe.

  Public static bool justice (this law enforcement method infographics) {If (Hansensea Parameter (LegalInfo)) {Back to Truth; } Return methodInfoRetType Ispinter; } Private static boolean usuf parameter (methodbase method) {var parameter = methodbase. Gate parameter (); Bool hasUnsafe = parameters.Any (p = & gt; p.ParameterType.IsPointer); The return is; }  

It does not handle in a fixed position, where an unsafe block is executed in a method, but again, the interest I am interested in is the signature.

Thank you! Unfortunately the unprotected keyword only wrapped the body of the method in the insecure block and does not emit anything else,


Comments

Popular posts from this blog

windows - Heroku throws SQLITE3 Read only exception -

lex - Building a lexical Analyzer in Java -

python - rename keys in a dictionary -