clement

clement

  • NA
  • 3
  • 0

Use value-type references with generic

Sep 14 2008 9:46 PM
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)