[CSharp.net] Collection oder array?

Mansur Esmann [OM] csharp.net at glengamoi.com
Tue, 18 May 2004 10:09:16 +0200


wieder mal ein Punkt wo ich keine Ahnung habe ...

Ich habe eine Klasse erstellt die von einer anderen (PointMapShape) erbt:

public class GISPoint : PointMapShape
{
	public GISPoint(PointShape aPointShape) : base()
	{
		this.mBaseShape = aPointShape;
		...
	}
}

In einer Methode setze ich das ein und es klappt auch wunderbar:
gp = new GISPoint(...);

So jetzt will ich aber folgendes schreiben:
public static GISPoint[] PointMapShape(...)
{
	GISPoint[] result;	// <-- Dazu unten:
	result[1] = new GISPoint(...);
	return result;
}

Ich kann aber klarerweise nicht "GISPoint result;" schreiben. Ich muss es initialisieren.
GISPoint[] result = new GISPoint(....);

Das gibt mir aber den Fehler das ich nicht von GISPoint zu GISPoint[] wandeln kann ...
auch klar ...
Aber ich habe jetzt keine Ahnung wie ich die (Nennt man das so:) Collection - Fähigkeit meiner
Klasse geben kann ....

Da fehlen mir irgendwelche Basics ....

Kann mir das wer erklären?

Mansur