Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/.net/24.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 当属性名与类名相同时,IntelliSense不使用扩展方法_C#_.net_Naming Conventions_Extension Methods_Intellisense - Fatal编程技术网

C# 当属性名与类名相同时,IntelliSense不使用扩展方法

C# 当属性名与类名相同时,IntelliSense不使用扩展方法,c#,.net,naming-conventions,extension-methods,intellisense,C#,.net,Naming Conventions,Extension Methods,Intellisense,基于这个答案:“,我开始使用与其类名相同的属性名。但最近我遇到了一个奇怪的角落案例,我不知道这是否只是我的问题,以及如何解决它。下面是重复该情况的代码: class R { public Test Test { get; private set; } public R() { Test = new Test(); // IntelliSense not working here: // Test.Use( } }

基于这个答案:“,我开始使用与其类名相同的属性名。但最近我遇到了一个奇怪的角落案例,我不知道这是否只是我的问题,以及如何解决它。下面是重复该情况的代码:

class R
{
    public Test Test { get; private set; }

    public R()
    {
        Test = new Test();

        // IntelliSense not working here:
        // Test.Use(
    }
}

public class Test    
{

}

public static class Extensions
{
    public static void Use(this Test test, string msg)
    {
        Console.WriteLine(msg);
    }
}
我正在使用VS2010和.NETFramework4.0


以下是显示问题的视频:

在选择属性时,是否可以尝试使用此选项

这个.Test.use()很有用,谢谢!(你将在24小时左右获得奖励)你对这种奇怪行为的原因有什么想法吗?这是因为Intelissense不确定你指的是班级还是财产,因此需要(这个)东西声明‘嘿,我指的是班级成员’没有,它知道我指的是属性,因为它在combobox中显示
Use
方法。类
Test
没有静态
Use
方法。不显示
Use
方法参数的原因非常奇怪。我想可能是个虫子。