2
Reply

Use value-type references with generic

clement

clement

Sep 14 2008 9:46 PM
2.2k
Dear C# experts,
Is there any way to parametrize generics with value type reference.
I want to do something like this :

myObject.ID = 1;
List<ref int> myInts = new List<ref int>();
myInts.add(ref myObject.ID);
myInts[0] = 2;
Assert.IsTrue(myObject.ID == 2);

Answers (2)