Autor Beitrag
mr.eddy
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 23



BeitragVerfasst: Mo 14.01.08 17:05 
ich hab jetzt z.B. ein array arrayname[stelle]= inhalt
wenn ich nun anhand des inhalts die die stelle erfahren will würd ich
ausblenden C#-Quelltext
1:
2:
3:
4:
5:
6:
7:
for(int i = 0; i != arraygröße;i++)
{
   {
    if( array[i] == inhalt)
   {
    return i;
}



doch wie stelle ich das nun bei einem 2dimensionalen array : arrayname[stelle_x, stelle_y]= inhalt

??
bakachan
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starofftopic star
Beiträge: 503
Erhaltene Danke: 34

W7 (x64) Ultimate
C# / VB.NET (VS2010 Ultimate)
BeitragVerfasst: Mo 14.01.08 17:15 
Also entweder du benutzt deinen jetzigen ansatz und läufst für jedes x jedes y durch
(also eine geschaltelte schleife) oder (was ich dir empfehlen würde) du benutzt ein Dictionary
ausblenden C#-Quelltext
1:
Dictionary<Point, String> test = new Dictionary<Point, string>();					


im Point sind deine 2 Koordinaten drinne ^^
die abfrage könnte man dann in etwa so machen :
ausblenden C#-Quelltext
1:
2:
string inhalt;
            test.TryGetValue(new Point(x, y), out inhalt);


Moderiert von user profile iconChristian S.: Code- durch C#-Tags ersetzt
mr.eddy Threadstarter
ontopic starontopic starontopic starontopic starontopic starontopic starontopic starhalf ontopic star
Beiträge: 23



BeitragVerfasst: Mo 14.01.08 17:20 
dein ansatz blick ich net durch xD
aber ich habs dann mit jedes x jedes y durchlaufen probiert ^^
und bin mit einer doppelten forschleife hingekommen
danke