Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- static void Main()
- {
- List<String> str = new List<string>() { "a", "b", "c" };
- Method(str);
- foreach (var item in str)
- {
- Console.WriteLine(item);
- }
- Method1(ref str);
- foreach (var item in str)
- {
- Console.WriteLine(item);
- }
- Console.ReadLine();
- }
- private static void Method1(ref List<string> str)
- {
- str.Add("d");
- }
- private static void Method(List<string> str)
- {
- str = new List<string>() { "1", "2", "3" };
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement