K
Klaas
Hi All,
I have this piece of code :
public interface IBase<T>
where T : BaseObject<T>, IBase<T>
{
public DataRow ObjectToDataRow(T Source);
}
public class BaseObject<T>
where T : BaseObject<T>, IBase<T>
{
public virtual DataRow ObjectToDataRow(T Source) { return null; }
public void Add(T Object)
{ innerData.Rows.Add(ObjectToDataRow(Object)); }
public void Save()
{
if (theDataRow == null)
ObjectToDataRow(this);
}
}
In Save() when I want to call ObjectToDataRow(this); I get that compile
error.
Why? [this] is already the type BaseObject!!! :-s
I want in the override function ObjectToDataRow in T to fill itself...
tia
I have this piece of code :
public interface IBase<T>
where T : BaseObject<T>, IBase<T>
{
public DataRow ObjectToDataRow(T Source);
}
public class BaseObject<T>
where T : BaseObject<T>, IBase<T>
{
public virtual DataRow ObjectToDataRow(T Source) { return null; }
public void Add(T Object)
{ innerData.Rows.Add(ObjectToDataRow(Object)); }
public void Save()
{
if (theDataRow == null)
ObjectToDataRow(this);
}
}
In Save() when I want to call ObjectToDataRow(this); I get that compile
error.
Why? [this] is already the type BaseObject!!! :-s
I want in the override function ObjectToDataRow in T to fill itself...
tia