W
Weeble
The included program compiles without errors, but produces an error
when you attempt to use a refactoring tool:
J:\TypeofTest\TypeofTest1\Program.cs(3,27): error CS0246: The type or
namespace name 'Bar' could not be found (are you missing a using
directive or an assembly reference?)
In addition, the syntax highlighter doesn't highlight the "Bar" in
"typeof(Bar)" as a class. If I replace that with "typeof(Foo.Bar)",
everything works as expected. What I don't understand is why there is
a difference. Should it be possible to implicitly reference an inner
class in an attribute like this (in which case it seems the
refactoring compiler is incorrect) or is it in fact not allowed (in
which case surely the regular compiler should say something)? I'm
using Visual Studio 2005.
using System.Diagnostics;
[DebuggerTypeProxy(typeof(Bar))]
public class Foo
{
public class Bar
{
private Foo m_foo;
public Bar(Foo foo) { m_foo = foo; }
}
}
class Program
{
static void Main() { }
}
when you attempt to use a refactoring tool:
J:\TypeofTest\TypeofTest1\Program.cs(3,27): error CS0246: The type or
namespace name 'Bar' could not be found (are you missing a using
directive or an assembly reference?)
In addition, the syntax highlighter doesn't highlight the "Bar" in
"typeof(Bar)" as a class. If I replace that with "typeof(Foo.Bar)",
everything works as expected. What I don't understand is why there is
a difference. Should it be possible to implicitly reference an inner
class in an attribute like this (in which case it seems the
refactoring compiler is incorrect) or is it in fact not allowed (in
which case surely the regular compiler should say something)? I'm
using Visual Studio 2005.
using System.Diagnostics;
[DebuggerTypeProxy(typeof(Bar))]
public class Foo
{
public class Bar
{
private Foo m_foo;
public Bar(Foo foo) { m_foo = foo; }
}
}
class Program
{
static void Main() { }
}