Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace ConsoleApplication16
- {
- class Program
- {
- static void Main(string[] args)
- {
- var collection = new List<int>
- {
- 5, 6, 7, 8, 9, 10
- };
- Test(collection);
- foreach(var value in collection)
- {
- Console.WriteLine(value);
- }
- var result = new List<int>
- {
- 5, 6, 7, 8, 9, 10
- };
- try
- {
- Test(ref result);
- foreach (var value in result)
- {
- Console.WriteLine(value);
- }
- } catch(Exception ex)
- {
- Console.WriteLine(ex.Message);
- }
- }
- static void Test(List<int> collection)
- {
- collection = null;
- }
- static void Test(ref List<int> collection)
- {
- collection = null;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement