i in interview , interviewer asked me below question.
how know classes , methods present in dll ?
i confused , said, "we can use tool or refactor that."
can explain different ways
find dll (from code tools
)
i suspect interviewer referring reflection. example:
var assembly = ...; // e.g. typeof(sometype).assembly var types = assembly.gettypes(); var methods = types.selectmany(type => type.getmethods()); // etc
you'd need filter types using type.isclass
classes, example. linq useful when working reflection query specific parts of type or assembly. note parameterless getmethods()
call above return public methods; can specify bindingflags
value retrieve non-public methods well.
Comments
Post a Comment