troubleshooting Question

Convert Task C# to vb.net

Avatar of rfl
rflFlag for Portugal asked on
Visual Basic.NETC#
2 Comments1 Solution11 ViewsLast Modified:
Hi,

I need convert code snippet c# to vb.net. I used the telerik converter, but it seems that automatic conversion is not possible. Someone can help how to implement a task and receive the result.  
C# code
 public bool SendData(string key, string name, string mytext)
        {

            var mytask = Task.Run(() => Send(key, name, mytext));

            var result = mytask.Result;

            return result;
            
        }

Converted Vb.Net code:

Public Function SendData(ByVal key As String, ByVal name As String, ByVal mytext As String) As Boolean
    Dim task = Task.Run(Function() Send(key, name, mytext))
    Dim result = task.Result
    Return result
End Function

After convert give me an error in task.

best regards
ASKER CERTIFIED SOLUTION
David H.H.Lee
Digital Marketing (Hospitality)
Join our community to see this answer!
Unlock 1 Answer and 2 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 2 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros