POV-Ray : Newsgroups : povray.off-topic : C# 4.0 Default parameters : Re: C# 4.0 Default parameters Server Time
9 Oct 2024 19:12:52 EDT (-0400)
  Re: C# 4.0 Default parameters  
From: Mike Raiford
Date: 4 Feb 2009 13:06:18
Message: <4989d91a$1@news.povray.org>
Warp wrote:
> Mike Raiford <"m[raiford]!at"@gmail.com> wrote:
>> C# uses delegates, instead.
> 
>   How do they work for member functions?
> 

Transparently.

e.g.

delegate void myDel(int x);

class SomeClass
{
   public int myValue;

   public void DoInstanceStuff(int x)
   {
     myValue = x;
   }

   public static void Main()
   {
     SomeClass c = new SomeClass();

     myDel d = c.DoInstanceStuff

     d(6); // this sets c.myValue to 6;

   }
}

-- 
~Mike


Post a reply to this message

Copyright 2003-2023 Persistence of Vision Raytracer Pty. Ltd.