- Home /
Question by
sona.viswam · May 09, 2013 at 11:03 AM ·
errorarraylist
ArrayList declaration
i declared a arraylist in class
private ArrayList alphabets = new ArrayList({"A", "B", "C", "D"});
getting errors
error CS1526: A new expression requires () or [] after type:
error CS1519: Unexpected symbol `B' in class, struct, or interface
member declaration
error CS8025: Parsing error
How to escape from this? I want to check first alphabet of word exist in that arraylist
Comment
Best Answer
Answer by aaronov · May 09, 2013 at 11:11 AM
Your syntax is wrong. What you want is this:
ArrayList alphabets = new ArrayList{"A", "B"};
Your answer
![](https://koobas.hobune.stream/wayback/20220613101902im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
SetActive() Object reference not set to an instance of an object. 1 Answer
Can you help me find the script error please? 1 Answer
BCE0044 expecting ), found 'script' and BCE0043 unexpected token ) 2 Answers
The name 'Joystick' does not denote a valid type ('not found') 2 Answers
Script not working (Java script) 2 Answers