Search Results

Search found 1 results on 1 pages for 'akavel'.

Page 1/1 | 1 

  • a constructor as a delegate - is it possible in C#?

    - by akavel
    I have a class like below: class Foo { public Foo(int x) { ... } } and I need to pass to a certain method a delegate like this: delegate Foo FooGenerator(int x); Is it possible to pass the constructor directly as a FooGenerator value, without having to type: delegate(int x) { return new Foo(x); } ? EDIT: For my personal use, the question refers to .NET 2.0, but hints/responses for 3.0+ are welcome as well.

    Read the article

1