M
msnews.microsoft.com
Is it possible to have a property return (get) one type but be assigned
(set) from another type?
Something like:
private int _InvoiceTypeID;
public InvoiceType InvoiceType
{
get
{
return this.GetInvoiceTypeFromDB(this._InvoiceTypeID);
}
set(int InvoiceTypeID)
{
this._InvoiceTypeID = (int)value;
}
}
Obviously this doesn't work. But it's what I want to accomplish. This may
also not be good practice as it is kind of confusing to have a property be
set/get with different types. If this is the case I will find another
way....
Josh
(set) from another type?
Something like:
private int _InvoiceTypeID;
public InvoiceType InvoiceType
{
get
{
return this.GetInvoiceTypeFromDB(this._InvoiceTypeID);
}
set(int InvoiceTypeID)
{
this._InvoiceTypeID = (int)value;
}
}
Obviously this doesn't work. But it's what I want to accomplish. This may
also not be good practice as it is kind of confusing to have a property be
set/get with different types. If this is the case I will find another
way....
Josh