reflection - Convert c# by-reference type to the matching non-by-reference type -



reflection - Convert c# by-reference type to the matching non-by-reference type -

i examine parameters of c# method using reflection. method has out parameters , these types, have isbyref=true. illustration if parameter declared "out string xxx", parameter has type system.string&. there way convert system.string& system.string? solution should of course of study not work system.string type.

use type.getelementtype().

demo:

using system; using system.reflection; class test { public void foo(ref string x) { } static void main() { methodinfo method = typeof(test).getmethod("foo"); type stringbyref = method.getparameters()[0].parametertype; console.writeline(stringbyref); type normalstring = stringbyref.getelementtype(); console.writeline(normalstring); } }

c# reflection

Comments

Popular posts from this blog

delphi - blogger via idHTTP : error 400 bad request -

c++ - compiler errors when initializing EXPECT_CALL with function which has program_options::variables_map as parameter -

How do I check if an insert was successful with MySQLdb in Python? -