Changed Property - CalledFrom - Returns Method that called the current Method

This commit is contained in:
Rich 2010-10-19 15:53:44 +00:00
parent ecb9f7f872
commit 4e8b7932bd

View File

@ -118,16 +118,14 @@ namespace Volian.Base.Library
int count = 0;
foreach (StackFrame sf in sfs)
{
if (sf.GetFileLineNumber() != 0)
if (sf.GetFileLineNumber() != 0) // Only look at Local Methods
{
count++;
if (count > 4) // The fourth entry should be the Calling Method
{
string sMethod = sf.GetMethod().Name;
string sNamespace = sf.GetMethod().ReflectedType.Namespace;
string sType = sf.GetMethod().ReflectedType.Name;
sMethod += string.Format(" {0}[{1}]", sf.GetFileName(), sf.GetFileLineNumber());
if (count > 3)
return string.Format("{0}.{1}.{2}", sNamespace, sType, sMethod);
string sMethod = sf.GetMethod().Name;
return string.Format("{0}.{1}[{2}]", sType, sMethod, sf.GetFileLineNumber());
}
}
}