I am writing a code analysis tool that uses reflection to validate a particular code base. When I encounter a type or member of interest I would like to load the symbols and extract the source file and line number where the member or type is defined. Is this possible? If so, how?
class SourceInfo
{
public static SourceInfo GetFrom(MemberInfo member)
{
// What do I do here??
throw new NotImplementedException();
}
public static SourceInfo GetFrom(Type member)
{
// What do I do here??
throw new NotImplementedException();
}
public string SourceFilePath { get; private set; }
public int LineNumber { get; private set; }
}