1

I am playing around with the live templates for C# in ReSharper. I started doing this because of this question. When I get the the ReSharper templates explorer in Visual Studio, I see that there is a #if template and also an if template. My question is why?

I have read through the ReSharper help here, but that doesn't really shed much light on it (for me). I have also tried un-checking each template. It seems like the if template is the ReSharper if snippet, but I can't figure out what the #if template is for.

Is this the Visual Studio if snippet? If so, why don't I see both in the intellisense widow?

I know this is a really small issue, but I just want to know. Thanks.

Piers Myers
  • 10,611
  • 6
  • 46
  • 61
Talbert1209
  • 165
  • 1
  • 2
  • 10

1 Answers1

3

#if is a preprocessor directive where as if is a C# selection statement

Example:

#if DEBUG
    Console.WriteLine("Debug version");
#endif

vs

bool condition = true;

if (condition)
{
    Console.WriteLine("The variable is set to true.");
}
Piers Myers
  • 10,611
  • 6
  • 46
  • 61