AW: [CSharp.net] Collection oder array?

Mansur Esmann [OM] csharp.net at glengamoi.com
Tue, 18 May 2004 13:13:29 +0200


Ja so ähnlich habe ich mir das vorgestellt ...

Aber meine Versuche gehen noch in die falsche Richtung:
namespace Toolbox.GIS
{
	/// <summary>
	/// Represents an collection of LineMapShapes
	/// </summary>
	public class GISLineMapShapeCollection: ArrayList
	{
		public GISLineMapShapeCollection()
		{}

		/// <summary>
		/// Represents an LineMapShape
		/// </summary>
		public class GISLineMapShape : LineMapShape
		{
			public GISLineMapShape(LineShape aLineShape) : base()
			{
				this.mBaseShape = aLineShape;
			}

			public void Dosomething(){}
		}
	}
}


ich würde dann gerne folgendes schreiben:

GISLineMapShapeCollection[] x = new GISLineMapShapeCollection(someLineShape);

foreach(GISLineMapShape y in GISLineMapShapeCollection.GISLineMapShape)
{
	y.Dosomething();
}

Irgendwie ist da noch grundsätzlich der Wurm drinnen ....

Wie nennt man denn das ganze und nach was kann ich denn suchen um Beispiele zu sehen von dem was ich
hier versuche ..

Gruß MAnsur

>
> Hallo,
>
> >  Womit ich aber ein Problem habe ist wie ich es einsetze:
> >
> > public class GISPoint : PointMapShape, ArrayList
> >
> > das geht ja nicht, weil an der Stelle eine Schnittstelle kommt ....
> >
> > Heisst das ich sollte GISPoint als ArrayList definieren und
> > darunter dann eine public - klasse
> > reintun, die den tatsächlichen GISPoint representiert?
>
> genau - oder GISPointCollection.
>
> Aufruf:
>
> GISPointCollection gisPoints = new GISPointCollection();
> GISPoint gisPoint = new GISPoint();
> gisPoint.MachWas();
> gisPoint.EinWert = 123;
> gisPoints.Add(gisPoint);
> .....
>
> Später dann z.B.:
>
> foreach(GISPoint gisPoint in gisPoints)
> {
> 	gisPoint.MachWas();
> }
>
> Gruss
>
> Alex
>
> Kommt zur .NET Community Conference in Karlsruhe
> http://www.dotnetcommunityconference.com
>
>
> _______________________________________________
> CSharp.net Mailingliste, Postings senden an:
> CSharp.net@glengamoi.com
> An-/Abmeldung und Suchfunktion unter:
> http://www.glengamoi.com/mailman/listinfo/csharp.net