struct list ?

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

i have a structure like

public struct structure
{
public int net_id;
public string net_desc;
public string net_mail;
public string[] update;
public string[] select;
}

i want to create an structure array whose length is undefined... but i keep
adding new copies of struct to array how could i make it. ???
 
oh my god :) i did it...

using System;
using System.Collections;

public class structlist
{
public struct Structure
{
public int net_id;
public string net_desc;
public string net_mail;
public ArrayList update;
public ArrayList select;
}

public static void Main()
{
ArrayList list = new ArrayList();
Structure copy;
copy.update = new ArrayList();
copy.select = new ArrayList();
for(int i=0;i<3;i++){
copy.net_id = i;
copy.net_desc = "deneme " + i;
copy.net_mail = "mail@mail"+ i +".com";
list.Add(copy);
}
foreach(Structure item in list)
Console.Write(
"net_id = "+item.net_id+"\n"+
"net_desc = "+item.net_desc+"\n"+
"net_mail = "+item.net_mail+"\n"+
"----------------------------\n");
}
}
 
Back
Top