How do I ignore set and get when assigning or retrieving a value?
- by cbsch
Hello. Is it possible to ignore set and get when I'm assigning to or retrieving a value?
In specific, I'm inheriting from a class that has a property declared like this:
public Int32 Value { get; set; }
What I'd like to do is to override it and do something useful in those set and get's. The problem appears when I override it, I also have to manually assign, or return the value from the property. If I do something like this:
override public Int32 Value
{
get
{
return this.Value;
}
set
{
this.Value = value;
// do something useful
}
Then I'm creating an infinite loop. Is there a way to set or get the value without invoking the code in set and get, or do I have to make a separate name for the actual variable?