How do you do an assignment of a delegate to a delegate in .NET 2.0
Posted
by Seth Spearman
on Stack Overflow
See other posts from Stack Overflow
or by Seth Spearman
Published on 2010-05-07T20:51:40Z
Indexed on
2010/05/09
11:28 UTC
Read the original article
Hit count: 426
Hello...
I just go the answer on how to pass a generic delegate as a parameter. Thanks for the help. Now I need to know how to ASSIGN the delegate to another delegate declarartion. Can this be done?
Public Class MyClass
Public Delegate Function Getter(Of TResult)() As TResult
''#the following code works.
Public Shared Sub MyMethod(Of TResult)(ByVal g As Getter(Of TResult))
''# I want to assign Getter = g ''#how do you do it.
End Sub
End Class
Notice that Getter is now private. How can I ASSIGN Getter = G
When I try Getter = g 'I get too few type arguments compile error. When I try Getter(Of TResult) = g 'I get Getter is a type and cannot be used as an expression.
How do you do it?
Seth
© Stack Overflow or respective owner