B
Brian Corcoran
I don't normally use interfaces that much, but I have a situation where I
think it makes sense. But it is acting strange (to me anyways)
I have an interface that requires a Get for a property. But, in a class
that implements that interface,
the class provides both a get and a set for that property.
When I use that class in my code, intead of getting "Class.Property", i get
"Class.get_Property" and "Class.set_Property"
I know that the property is eventually compiled as a seperate get and set,
but I don't understand why it is showing up here.
Here's an generic example of my code:
public interface IPhone
{
string DisplayName
{
get;
}
string Extension
{
get;
}
}
public class Person : IPhone
{
public Person()
{}
private string _name;
private string _extension;
public string DisplayName
{
get { return _name; }
}
public string Extension
{
get { return _extension; }
set { _extension = value; }
}
}
public void Example()
{
Person a = new Person();
a.set_Extension = '1234';
}
think it makes sense. But it is acting strange (to me anyways)
I have an interface that requires a Get for a property. But, in a class
that implements that interface,
the class provides both a get and a set for that property.
When I use that class in my code, intead of getting "Class.Property", i get
"Class.get_Property" and "Class.set_Property"
I know that the property is eventually compiled as a seperate get and set,
but I don't understand why it is showing up here.
Here's an generic example of my code:
public interface IPhone
{
string DisplayName
{
get;
}
string Extension
{
get;
}
}
public class Person : IPhone
{
public Person()
{}
private string _name;
private string _extension;
public string DisplayName
{
get { return _name; }
}
public string Extension
{
get { return _extension; }
set { _extension = value; }
}
}
public void Example()
{
Person a = new Person();
a.set_Extension = '1234';
}