开发者

How to do this vb 2010

Int32 number = new Random().Next();
Console.WriteLine(number);

Func<Int32> Gene开发者_C百科rateRandom = delegate() { return new Random().Next(); };

Console.WriteLine("Begin Call");
GenerateRandom.DoAsync(number => Console.WriteLine(number));
Console.WriteLine("End Call"); 


Dim number As Int32 = New Random().[Next]()
Console.WriteLine(number)

Dim GenerateRandom As Func(Of Int32) = Function() New Random().[Next]()

Console.WriteLine("Begin Call")
GenerateRandom.DoAsync(Function(number) Console.WriteLine(number))
Console.WriteLine("End Call")


Dim number As Int32 = New Random().[Next]()
Console.WriteLine(number)

Dim GenerateRandom As Func(Of Int32) = Function() New Random().[Next]()

Console.WriteLine("Begin Call")
GenerateRandom.DoAsync(Function(number) Console.WriteLine(number))
Console.WriteLine("End Call")


Here's a quick code conversion from http://converter.telerik.com/. I tested it and it seems to work.

Dim number As Int32 = New Random().[Next]()
Console.WriteLine(number)

Dim GenerateRandom As Func(Of Int32) = Function() New Random().[Next]()

Console.WriteLine("Begin Call")
GenerateRandom.DoAsync(Function(number) Console.WriteLine(number))
Console.WriteLine("End Call")


Heres' a translation.

Dim random = New Random()
Dim number = random.Next()
Console.WriteLine(number)

Dim GenerateRandom = Function ()
    Dim random = New Random()
    Dim number = random.Next()
  End Function

Console.WriteLine("Begin Call")
GenerateRandom.DoAsync(Sub (number) Console.WriteLine(number))
Console.WriteLine("End Call")


Reflector is an easy and free way to convert between .NET languages.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜