title: Struct constructor: "fields must be fully assigned before control is returned to the caller."
body: <p>Here is a struct I am trying to write:</p>
  
  <pre><code>  public struct AttackTraits
          {
              public AttackTraits(double probability, int damage, float distance)
              {
                  Probability = probability;
                  Distance = distance;
                  Damage = damage;
              }
  
              private double probability;
              public double Probability
              {
                  get
                  {
                      return probability;
                  }
                  set
                  {
                      if (value &gt; 1 || value &lt; 0)
                      {
                          throw new ArgumentOutOfRangeException("Probability values must be in the range [0, 1]");
                      }
                      probability = value;
                  }
              }
  
              public int Damage { get; set; }
  
              public float Distance { get; set; }
          }
  </code></pre>
  
  <p>This results in the following compilation errors:</p>
  
  <blockquote>
    <p>The 'this' object cannot be used
    before all of its fields are assigned
    to    </p>
    
    <p>Field 'AttackTraits.probability' must
    be fully assigned before control is
    returned to the caller</p>
    
    <p>Backing field for automatically
    implemented property
    'AttackTraits.Damage' must be fully
    assigned before control is returned to
    the caller. Consider calling the
    default constructor from a constructor
    initializer.</p>
    
    <p>Backing field for automatically
    implemented property
    'AttackTraits.Distance' must be fully
    assigned before control is returned to
    the caller. Consider calling the
    default constructor from a constructor
    initializer.</p>
  </blockquote>
  
  <p>What am I doing wrong?</p>