Re: Collection, collectioneditor and constructor
- From: "Nicholas Paldino [.NET/C# MVP]" <mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx>
- Date: Wed, 17 Oct 2007 14:40:14 -0400
Isn't your Add method going to create the new instance and then return
it? If so, then just call the constructor to the Row class which will take
the height. Mark the constructor as internal, so that classes outside of
your assembly can't access it.
For this to work though, your Add method can't allow an existing
instance to be passed to the method, it has to take properties which you
then use to create the instance, and then add that to the collection.
--
- Nicholas Paldino [.NET/C# MVP]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx
"R.A.F." <noemail@xxxxxxxxxx> wrote in message
news:Ob0svnOEIHA.3712@xxxxxxxxxxxxxxxxxxxxxxx
Hi,
I'm still having my issue with my collection.
I remind you the facts :
- I have a class called "Row".
- I have a collectionbase class named "RowsCollection"
- I have a collectionEditor class called "RowsCollectionEditor".
When i add a new row into the collection class, my new row should have its
property Height, setup to default value = 20. This default value for row
height is written as private static readonly into my RowsCollection class.
I know that Row constructor should allow such parameter like :
public Row(RowsCollection owner, int iHeight)
{
...
this.Height = iHeight
...
}
But my problem is that i do not understand from where should i call this
constructor.
1. Should i call it from RowsCollection method ? if yes, from which one
and how ?
2. Should i call it from RowsCollectionEditor method ? if yes, from which
one and how ?
i tried to find something about createnewinstance from
RowsCOllectionEditor or Add method (overriden) from RowsCollection but
nothing works...
So i'm confused. :-(
Any help would be wonderfull,
thx,
RAF
.
- Follow-Ups:
- Re: Collection, collectioneditor and constructor
- From: R.A.F.
- Re: Collection, collectioneditor and constructor
- References:
- Collection, collectioneditor and constructor
- From: R.A.F.
- Collection, collectioneditor and constructor
- Prev by Date: Re: How to Bold the text in a field at DataTable
- Next by Date: Re: Finally which ORM tool?
- Previous by thread: Re: Collection, collectioneditor and constructor
- Next by thread: Re: Collection, collectioneditor and constructor
- Index(es):
Relevant Pages
|