title: How to know whether a control is at design-time or not?
body: <p>I have a class (control), implementing ICustomTypeDescriptor, which is used both at design-time and run-time by PropertyGrid for customization. I need to expose different properties at design-time (standard controls properties like <code>width</code>, <code>height</code> and so on) and at run-time, when PropertyGrid is used in my program to change other properties of that control.</p>
  
  <p>My code is like:</p>
  
  <pre><code>class MyControl : UserControl, ICustomTypeDescriptor
  {
      //Some code..
  
      public PropertyDescriptorCollection GetProperties(Attribute[] attributes)
      {
          return GetProperties();
      }
  
      public PropertyDescriptorCollection GetProperties()
      {
          //I need to do something like this:
          if (designTime)
          { //Expose standart controls properties
              return TypeDescriptor.GetProperties(this, true);
          }
          else
          {
              //Forming a custom property descriptor collection
              PropertyDescriptorCollection pdc = new PropertyDescriptorCollection(null);
              //Some code..
              return pdc;
          }
      }
  }
  </code></pre>
  
  <p>Is there an analog for a design-time flag in C#? Is it maybe better to use conditional compilation?</p>