astef
astef

Reputation: 9498

IntelliSense do not work with extension method when property name is the same as class name

Based on this answer: " Should a property have the same name as its type? ", I've started to use property names the same as their class names. But recently I've met a strange corner case and I don't know if it is only my problem and how to solve it. Here is the code to repeat the case:

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);
    }
}

I'm using VS2010 and .NET Framework 4.0

Here is the video showing the problem: http://www.youtube.com/watch?v=HgszAu_Pir0&feature=youtu.be

Upvotes: 3

Views: 695

Answers (1)

Geo A. Fragedakis
Geo A. Fragedakis

Reputation: 134

Could you try using .this when selecting the property?
eg. this.Test.use() ..

Upvotes: 1

Related Questions