Calling VB.NET method from C#

V

Vijay

Hi,

I do have the VB.NET method which has delegate as parameter.
I am calling this method from VB.NET project by using the commnad "Addressof( Function name which has same signature)".
How can i call the same method from C# Project?

Code Sample:

Delegate Definition on class inwhich VB.NET method is located.
Public Delegate Function fnRejectDelegate(ByVal dr As DataRow) As Boolean

VB.NET method definition.

Public Function GetFirstPage(ByVal pSize As Int16, ByVal delReject As fnRejectDelegate) As DataTable

Calling statement in VB.NET project

dtTemp = ctaTicketManager.GetFirstPage(5, AddressOf reject)

Function in VB.NET project with same delegate signature

Private Function reject(ByVal dr As DataRow) As Boolean

End Function

Since we don't have equivalent for "Addressof" operator in C#, how can we call the same method from C# project?

Thanks,

Vijay
 
B

bruce barker

bool reject(DataRow dr)
{
}

dtTemp = ctaTicketManager.GetFirstPage(5, new fnRejectDelegate(reject));



-- bruce (sqlwork.com)



Hi,

I do have the VB.NET method which has delegate as parameter.
I am calling this method from VB.NET project by using the commnad "Addressof( Function name which has same signature)".
How can i call the same method from C# Project?

Code Sample:

Delegate Definition on class inwhich VB.NET method is located.
Public Delegate Function fnRejectDelegate(ByVal dr As DataRow) As Boolean

VB.NET method definition.

Public Function GetFirstPage(ByVal pSize As Int16, ByVal delReject As fnRejectDelegate) As DataTable

Calling statement in VB.NET project

dtTemp = ctaTicketManager.GetFirstPage(5, AddressOf reject)

Function in VB.NET project with same delegate signature

Private Function reject(ByVal dr As DataRow) As Boolean

End Function

Since we don't have equivalent for "Addressof" operator in C#, how can we call the same method from C# project?

Thanks,

Vijay
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top