I have a list and a string
var Resnames= new List<string>();
string name = "something";
I want to append string to it like
Resnames += name;
How can I do it
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Since you are using List (not a legacy fixed-size array) you able to use List.Add() method:
If you want to add an item after the instantiation of a list instance you can use object initialization (since C# 3.0):
Also you might find useful List.AddRange() method as well