小编Ale*_*der的帖子

C#。为什么当我使用 TextReader.Read() 时它返回一个 int 值?可以转换成char吗?

因此 TextReader.ReadLine() 返回一个字符串,但 TextReader.Read() 返回一个 int 值。这个 int 值似乎也是某种我无法识别的格式。是否可以将这个整数转换为字符?谢谢你的帮助。

编辑:

TextReader 值 = new StreamReader(@"txt");

    string SValue1;
    int Value1;       
    Value1 = Values.Read();        
    Console.WriteLine(Value1);
    Console.ReadKey();
Run Code Online (Sandbox Code Playgroud)

当它读出值时,它给出 51 作为输出。txt文件中的第一个字符是3。为什么会这样做呢?

c# input int32 char textreader

5
推荐指数
1
解决办法
4724
查看次数

标签 统计

c# ×1

char ×1

input ×1

int32 ×1

textreader ×1