polatyener adlı üyeden alıntı: mesajı görüntüle
Arkadaşlar gelen verileri aşağıdaki gibi foreach içinde döndürüyorum fakat bunları aşağıdaki örnekte göründüğü şekilde dizi olarak nasıl dönüştürebilirim.

Benim Kodlarım:
specType uruntipSpec1 = new specType();
foreach (Control c in pnlSpecs.Controls)
{
    trChar.Ceviri = c.Name;
    string SPCName = trChar.FriendlyURLTitle();
    uruntipSpec1.name = c.Name;
    uruntipSpec1.type = "CheckBox";
    uruntipSpec1.value = c.Text;
    uruntipSpec1.required = Equals(c.Tag);
}
product.specs = uruntipSpec1;
Örnek Kodlar:
specType brandSpec = new specType();
brandSpec.name = "Marka";
brandSpec.type = "Combo";
brandSpec.value = "Adidas";
brandSpec.required = true;
....

specType[] specTypeArray = new specType[10];
specTypeArray[0] = brandSpec;
...

product.specs = specTypeArray;
List<specType> sList = new List<specType>();
foreach (Control c in pnlSpecs.Controls)
{
specType uruntipSpec1 = new specType();
trChar.Ceviri = c.Name;
string SPCName = trChar.FriendlyURLTitle();
uruntipSpec1.name = c.Name;
uruntipSpec1.type = "CheckBox";
uruntipSpec1.value = c.Text;
uruntipSpec1.required = Equals(c.Tag);
sList.Add(uruntipSpec1);
}
            product.specs = sList.ToArray();