F
FireStarter
Guys, in the code that follows, why does the method F() still compile, even if
DBG is undefined? Inside method G(), the code inside <#if DBG> does not compile
(notice that I can write whatever I want in there, I will not receive a
compilation error). I do get such an error in F() - because of the garbage I
intentionally put there - but F() should not compile in the first place.
Am I misusing this [Conditional...] attribute?!
#undef DBG
using System.Diagnostics;
class Class1 {
public Class1() {
int y = 0;
}
public void G() {
int x = 0;
x++;
#if DBG
// garbage here, that does not generate
// compilation errors - correct
x*&$%bbb
#endif
}
[Conditional("DBG")]
public void F() {
// garbage here, that generates compilation errors,
// although this is a conditional method, and DBG is undefined
x*&$%bbb
}
}
DBG is undefined? Inside method G(), the code inside <#if DBG> does not compile
(notice that I can write whatever I want in there, I will not receive a
compilation error). I do get such an error in F() - because of the garbage I
intentionally put there - but F() should not compile in the first place.
Am I misusing this [Conditional...] attribute?!
#undef DBG
using System.Diagnostics;
class Class1 {
public Class1() {
int y = 0;
}
public void G() {
int x = 0;
x++;
#if DBG
// garbage here, that does not generate
// compilation errors - correct
x*&$%bbb
#endif
}
[Conditional("DBG")]
public void F() {
// garbage here, that generates compilation errors,
// although this is a conditional method, and DBG is undefined
x*&$%bbb
}
}