【问题标题】:is there any way to convert string to int for any array? [duplicate]有没有办法将任何数组的字符串转换为int? [复制]
【发布时间】:2016-04-18 19:47:29
【问题描述】:
static void Main(string[] args)
{
    int[] WS1_AF = File.ReadAllLines("WS1_AF.txt");
}

不知道如何从字符串转换为整数

【问题讨论】:

    标签: c#


    【解决方案1】:
    string[] readText = File.ReadAllLines("WS1_AF.txt");
    

    然后将其转换为 int 数组

    int[] WS1_AF = Array.ConvertAll(readText , int.Parse);
    

    【讨论】:

      猜你喜欢
      • 2021-04-04
      • 1970-01-01
      • 1970-01-01
      • 2020-12-23
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2023-01-30
      • 2020-09-17
      相关资源
      最近更新 更多