将VB转换为C# - My.Application.Info.DirectoryPath

Aar*_*man 15 c# vb.net

以下VB(VB.NET,VisualBasic)语句的最佳C#(csharp)等价物是什么:

My.Application.Info.DirectoryPath

My.Computer.Clipboard

My.Computer.Audio.PlaySystemSound()

My.Application.Shutdown()
Run Code Online (Sandbox Code Playgroud)

The*_*onk 23

Application.ExecutablePath

System.Windows.Forms.Clipboard

System.Media.*

Application.Exit

  • 这些对于Windows窗体应用程序可能是正确的 (3认同)

小智 5

My.Application.Info.DirectoryPath
  AppDomain.CurrentDomain.BaseDirectory

My.Computer.Clipboard
  System.Windows.Clipboard //(WPF)
  System.Windows.Forms.Clipboard //(WinForms)

My.Computer.Audio.PlaySystemSound()
  System.Media.SystemSounds.*.Play()

My.Application.Shutdown()
  System.Windows.Forms.Application.Exit() //(WinForms)
  or
  System.Windows.Application.Current.Shutdown()  //(WPF)
  or
  System.Environment.Exit(ExitCode)  //(Both WinForms & WPF)
Run Code Online (Sandbox Code Playgroud)