if you can identify your object than just put this information in the
Exception object
and if you cannot identify it, for example because of there a lot code in
the try statement, than you can show the part of the call stack, but AFAIK
you will not be able to obtaint the particular object
For example
public class MyObj
{
public long m_id;
public MyObj(long id)
{
m_id = id;
}
public void DoSomething()
{
}
}
MyObj obj = new MyObj(5)
try
{
obj.DoSomething();
}
catch
{
if (obj != null)
Log("Error with " + obj.m_id.ToString();
}
"Benny" <an*******@devdex.com> wrote in message
news:uf*************@tk2msftngp13.phx.gbl...
Hello Experts,
In C#, how can I find out which object (i.e. return me the object name)
causes the exception error in the try..catch... statement? I want to
display the object that caused the exception in the error message.
Thanks in advanced,
Benny
*** Sent via Developersdex http://www.developersdex.com ***
Don't just participate in USENET...get rewarded for it!