How can I create a string array in a struct?
i have developed something like this
struct menu
{
sMenuehaupt [] = new string sMenuehaupt[250]
}
but ist doesn't work.
its only possible to create a char array
Loading
Know the answer? Post it — somebody with the same question will find it here.
Sign in to answer this question
It is the same account you read, post and publish with — and you will come straight back to this page.
Jignesh TrivediPosted Feb 19, 2014, 11:59 PM
Agree with vulpes...
but we can initialize array object when ever required..
struct menu
{
public string[] sMenuehaupt;
}
menu m = new menu();
m.sMenuehaupt = new string[] { "s", "s", "s" };
hope this will help you.
VulpesPosted Feb 19, 2014, 11:30 AM
struct menu
This 'initialization' rule applies not only to string arrays but to any type of struct field.