Convert VB to C# - My.Application.Info.DirectoryPath

后端 未结 8 1849
自闭症患者
自闭症患者 2021-02-04 06:35

What are the best C# (csharp) equivalents for the following VB (VB.NET, VisualBasic) statements:

My.Application.Info.DirectoryPath

My.Computer.Clipboard

My.Com         


        
8条回答
  •  南旧
    南旧 (楼主)
    2021-02-04 06:42

    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)
    

提交回复
热议问题