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.
精彩评论