C# I can't get a field through reflexes
-
There's a class:
public class ExampleClass { private static readonly string ProtocolName = "prtclname"; }
I need to get his field.
ProtocolName
out of reflexia. I tried that:var field = typeof(ExampleClass) .GetType() .GetField("ProtocolName", BindingFlags.NonPublic | BindingFlags.Static);
Something's coming back.
null
♪
-
var field = typeof(ExampleClass) //.GetType() - у System.Type тоже есть Type .GetField("ProtocolName", BindingFlags.NonPublic | BindingFlags.Static);