在C#项目中添加引用Microsoft.VisualBasic.dll, 可以在C#程序中直接使用VB.NET中丰富的函数
 1 1// 命令行编译 : csc /r:Microsoft.VisualBasic.dll Test.cs
 2  2
 3  3// 如果是用 Visual Studio .NET IDE, 请按以下方法为项目添加引用:
 4  4// 打开[解决方案资源管理器], 右击项目名称, 选择[添加引用],
 5  5// 从列表中选择 Microsoft Visual Basic .NET Runtime 组件.
 6  6
 7  7using Microsoft.VisualBasic;
 8  8
 9  9class Test
10 10{
11 11  static void Main()
12 12  {
13 13    string s = "博客园-空军 [skyIV.cnBlogs.com]";
14 14    System.Console.WriteLine(s);
15 15    s = Strings.StrConv(s, VbStrConv.Wide              , 0); // 半角转全角
16 16    s = Strings.StrConv(s, VbStrConv.TraditionalChinese, 0); // 简体转繁体
17 17    System.Console.WriteLine(s);
18 18    s = Strings.StrConv(s, VbStrConv.ProperCase        , 0); // 首字母大写
19 19    s = Strings.StrConv(s, VbStrConv.Narrow            , 0); // 全角转半角
20 20    s = Strings.StrConv(s, VbStrConv.SimplifiedChinese , 0); // 繁体转简体
21 21    System.Console.WriteLine(s);
22 22  }
23 23}


End Function

相关文章:

  • 2022-02-11
  • 2022-12-23
  • 2022-02-11
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-15
  • 2021-10-29
猜你喜欢
  • 2021-10-02
  • 2022-12-23
  • 2021-11-23
  • 2022-12-23
  • 2022-12-23
  • 2021-07-28
  • 2022-12-23
相关资源
相似解决方案