gpt4 book ai didi

c# - Visual Studio 2015 智能测试 : The selected type is not visible and cannot be explored

转载 作者:行者123 更新时间:2023-11-30 15:25:22 24 4
gpt4 key购买 nike

我有以下代码:

class Program
{
static void Main(string[] args)
{
var area = AreaofSquare(5.0);
}

static double AreaofSquare(double side)
{
double area;
area = Math.Pow(side, 2);
return area;
}
}

当我右键单击 AreaofSquare 方法并选择运行 IntelliTest 时,我收到此错误消息:

The selected type is not visible and cannot be explored

为什么会出现这个错误?

最佳答案

IntelliTest 仅适用于公共(public)方法。将访问修饰符更改为 public 即可。

using System;

public class Program
{
static void Main(string[] args)
{
var area = AreaofSquare(5.0);
}

public static double AreaofSquare(double side)
{
double area;
area = Math.Pow(side, 2);
return area;
}
}

关于c# - Visual Studio 2015 智能测试 : The selected type is not visible and cannot be explored,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31310591/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com