title: C# stop custom attribute from being applied to class
body: <p>I've created a custom property in C#:</p>
  <pre class="lang-cs prettyprint-override"><code>[AttributeUsage(AttributeTargets.Property, Inherited = false, AllowMultiple = false)]
  public class ExampleAttribute : Attribute
  {
  }
  </code></pre>
  <p>I would like this to ONLY be applied to properties, but more specifically, properties that are not classes (just base types).</p>
  <p>Example:</p>
  <pre class="lang-cs prettyprint-override"><code>public class ExamplePoco
  {
      // These should be fine...
      [Example]
      public string Prop1 { get; set; }
      [Example]
      public bool Prop2 { get; set; }
      [Example]
      public int Prop3 { get; set; }
  
      // But this shouldn't be allowed because it's a class, rather than base type
      [Example]
      public OtherExample Prop4 { get; set; }
  }
  
  public class OtherExample
  {
      public string Other1 { get; set; }
  }
  </code></pre>
  <p>Does anyone know how I'd further restrict this custom attribute at compile time?  If this can only be done at runtime, what is the best way to approach this?</p>
  <p>Thanks in advance!</p>