小编Ves*_*hev的帖子

C# -> string.Reverse(); - 在 # using System.Linq 中不起作用;

这个程序没有按预期工作,我不知道为什么。错误是CS0266 " Error CS0266 Cannot implicitly convert type 'System.Collections.Generic.IEnumerable<char>' to 'string'. An explicit conversion exists (are you missing a cast?)

但是,它应该在使用 System.Linq 下正常工作;

using System;
using System.Linq;
namespace centuryyearsminutes
{
    class Program
    {
        static void Main(string[] args)
        {
            string aa = "Hello World!";
            string bb = aa.Reverse();
            Console.WriteLine(bb);
        }
    }
}
Run Code Online (Sandbox Code Playgroud)

c#

0
推荐指数
2
解决办法
6930
查看次数

在 C# TryParse 输出是 bool 还是 int?

我试图理解,但这不是输出@!如果是 bool ,则不能签名为 int,但如果是 int ,则不能签名为 bool。TryParse 成功后如何获取和使用数值?谢谢。

using System;

namespace TryParse
{
    class Program
    {
        static void Main(string[] args)
        {
            string input = Console.ReadLine();
            bool s;
            int a = int.TryParse(input, out @@@ WHAT ???? );


        }
    }
}
Run Code Online (Sandbox Code Playgroud)

c#

-8
推荐指数
1
解决办法
78
查看次数

标签 统计

c# ×2