2
Answers

Use value-type references with generic

clement

clement

16y
2.2k
1
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)