If I were to change the value of bool.TrueString
, I'd do it using Reflection:
typeof(bool).GetField("TrueString", BindingFlags.Public | BindingFlags.Static).SetValue(null, "Yes");
Console.WriteLine(bool.TrueString); // Outputs "Yes"
However, I cannot manage to change the value of, say, Type.Delimiter
:
typeof(Type).GetField("Delimiter", BindingFlags.Public | BindingFlags.Static).SetValue(null, '-');
Console.WriteLine(Type.Delimiter); // Outputs "."
Why is this?
Aucun commentaire:
Enregistrer un commentaire