Imagine I have the following class:
class Cow {
public static bool TryParse(string s, out Cow cow) {
...
}
}
Is it possible to call TryParse
via reflection? I know the basics:
var type = typeof(Cow);
var tryParse = type.GetMethod("TryParse");
var toParse = "...";
var result = (bool)tryParse.Invoke(null, /* what are the args? */);
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…