Home > Net >  C # code into VB.net code, blue picture!
C # code into VB.net code, blue picture!

Time:11-17

Help me put the picture blue background code into vb.net code, thank you

CodePudding user response:

That guy is the inline function method and write so many, I also like in Java so write... A prompt... Make yourself,

CodePudding user response:

Vb.net with c # basically exactly the same, write async, before the function keyword in the execution of internal command statement most write await in front,

CodePudding user response:

I don't write vb.net code, in order to you this problem I groped for the wrote a open vb demo, in fact as long as you have the most basic concept of vb.net and c # programming experience and a certain thickness, groping could soon be familiar with another "language", because in the.net languages is only the difference of experience, the principle is the same, are based on the framework of.net framework unified rigorous thinking,

 Module Module1 

Sub Main ()
Dim As a New a
Dim As New b b
AddHandler a.T estE, AddressOf b.e e
Atul gawande o (" triggering event ")
Console. WriteLine (" main program finished, press any key to end...
")The Console. ReadKey ()
End Sub

End the Module

Class A
Public Event TestE (sender As Object, e As EventArgs, haha As String)

Sub go (MSG As String)
RaiseEvent TestE (Me, Nothing, MSG)
End Sub
The End of the Class

Class B
Public Async Sub ee (sender As Object, e As EventArgs, haha As String)
Await Task. Yield
Console. WriteLine (" event execution _________ {0} ", haha)
End Sub
The End of the Class


Here I declare a custom event, and in another code (another Class) to provide the event handling code, I will process from synchronous to asynchronous execution, but is added to the async and await the two things, get rid of them you can see the difference between synchronous and asynchronous, synchronous, you will see the thread first walk to the prompt "press any key to end", the main thread of execution will not receive the least bit blocking of event processing, run concurrently,

CodePudding user response:

Using an anonymous delegate, vb can fully supports anonymous delegate, lambda, linq, and so on, the key is to many vb programmers as if still in vb knowledge of 20 years ago, vb.net have not learned in recent 15 years, this is a pity, but as long as you are. The net "a little confidence" you should believe that vb.net actually ability is almost the same as in c #,

 Module Module1 

Sub Main ()
Dim As a New a
AddHandler a.T estE, Async Sub (s As Object, e As EventArgs, haha As String)
Await Task. Yield
Console. WriteLine (" again, event execution _________ {0} ", haha)
End Sub
Atul gawande o (" triggering event ")
Console. WriteLine (" main program finished, press any key to end...
")The Console. ReadKey ()
End Sub

End the Module

Class A
Public Event TestE (sender As Object, e As EventArgs, haha As String)

Sub go (MSG As String)
RaiseEvent TestE (Me, Nothing, MSG)
End Sub
The End of the Class

CodePudding user response:

I'm not going to VB.NET. But I have a method.

Your cs wrote exe or DLL.. Then after compiled with ilspy open.. Choose the VB... Can see the VB source ha ha ha I was a cleverness.

CodePudding user response:

Also support async and lambda, vb,
But given text code, you don't answer your question I have to take typing service?

CodePudding user response:

Thank you, has been done

CodePudding user response:

reference 4 floor interacting in a professional developer response:
using an anonymous delegate, vb to fully support the anonymous delegate, lambda, linq, and so on, the key is to many vb programmers as if still in vb knowledge of 20 years ago, vb.net have not learned in recent 15 years, this is a pity, but as long as you are. The net "a little confidence" you should believe that vb.net actually ability is almost the same as in c #,

 Module Module1 

Sub Main ()
Dim As a New a
AddHandler a.T estE, Async Sub (s As Object, e As EventArgs, haha As String)
Await Task. Yield
Console. WriteLine (" again, event execution _________ {0} ", haha)
End Sub
Atul gawande o (" triggering event ")
Console. WriteLine (" main program finished, press any key to end...
")The Console. ReadKey ()
End Sub

End the Module

Class A
Public Event TestE (sender As Object, e As EventArgs, haha As String)

Sub go (MSG As String)
RaiseEvent TestE (Me, Nothing, MSG)
End Sub
The End of the Class

Thank you, I see
  • Related