Hi Goran
The BaseObject will be inherited by other classes. And I am defining an
extension to the
BindingList<T>.
I solved the problem by using the where keyworkd suggested by Barry and Mehdi.
Thanks for your feedback.
Regards,
Alan L.
Göran Andersson wrote:
>If you have a base class for all objects that the class handles, then
>you don't need to use generics at all in your class. Just use the base
>class when you inherit the BindingList.
>
>public abstract class BaseList : BindingList<BaseObject>
>
>Now your BaseList is a BindingList that handles any object that inherits
>from BaseObject.
>
>In your method that loops the items, just reference them as BaseObject:
>
>public void AcceptChanges() {
> foreach (BaseObject item in this.Items) {
> item.ObjectState = ObjectState.Unchanged;
> }
> DeletedRows.Clear();
>}
>
>> Hi Goran,
>>
>[quoted text clipped - 26 lines]
>>> ...
>>> }
>
--
Message posted via DotNetMonster.com
http://www.dotnetmonster.com/Uwe/For...users/200702/1