Adagio
Well-known member
- Joined
- Dec 12, 2005
- Messages
- 162
- Programming Experience
- Beginner
Does anybody here know if this is possible somehow?
Let's say that I have something like this:
I would like to call the WriteLog every time a sub, function or property is called in AwesomeClass
In this situation it would of course be easy just to add the WriteLog("Something") line for the situations here, but it's going to be a lot of work if the class has 100+ properties/methods, not to mention if I want to use this on AwesomeClass today and tomorrow I want to use it on SomeOtherClass
So basically I'm looking for an event (or something) that is raised whenever a method/property is called
But unfortunately my search has been fruitless
Is this even possible? I have only found something that can raise my event if an event on the class has been raised (like TextChanged on TextBox or whatever)
Let's say that I have something like this:
VB.NET:
Public sub WriteLog(str as string)
' Code to write to log
End Sub
Public class AwesomeClass
public sub DoSomething
End sub
public property SomeProperty as string
set
get
return "Nice"
end get
End property
End Class
I would like to call the WriteLog every time a sub, function or property is called in AwesomeClass
In this situation it would of course be easy just to add the WriteLog("Something") line for the situations here, but it's going to be a lot of work if the class has 100+ properties/methods, not to mention if I want to use this on AwesomeClass today and tomorrow I want to use it on SomeOtherClass
So basically I'm looking for an event (or something) that is raised whenever a method/property is called
But unfortunately my search has been fruitless
Is this even possible? I have only found something that can raise my event if an event on the class has been raised (like TextChanged on TextBox or whatever)