Hi,
I came across a question which made me confused. What is the use of having "ref" before s.MyFun in this case. I tried to remove it and it still works.
I understand the reason for putting it before a variable that the content can be changed subsequently. What is the use of this one ? the function content will not be changed.
class Sample { public void MyFun(int i, Single j) { Console.WriteLine("Welcome to IndiaBIX !"); } }delegate void del(int i, Single j); del d; Sample s = new Sample(); d = new del(ref s.MyFun); d(10, 1.1f);
Nanhe SiddiquePosted May 20, 2015, 12:39 AM