title: Calling a structure method inside a non-default structure constructor
body: <p>I have this very simple example that I am using to learn structs in C#:</p>
  
  <pre><code>struct ScreenPosition
  {
      // These are the two private members of the structure 
      private int x; 
      private int y;
  
      private int RangeCheckedX(int xPos)
      {
          if (xPos &lt; 0 || xPos &gt; 1280)
          {
              throw new ArgumentOutOfRangeException("X");
          }
          return xPos;
      }
  
      private int RangeCheckedY(int yPos)
      {
          if (yPos &lt; 0 || yPos &gt; 1024)
          {
              throw new ArgumentOutOfRangeException("Y");
          }
          return yPos;
      }
  
      // Declaring the non-default constructor
      public ScreenPosition(int X, int Y)
      {
          this.x = RangeCheckedX(X); // ERROR HERE
          this.y = RangeCheckedY(Y); // ERROR HERE
      }
  
      // Declaring  the property X - Follows a syntax. See the C# quick reference sheet 
      public int X
      {
          get
          {
              return this.x;
          }
  
          set
          {
              this.x = RangeCheckedX(value);
          }
      }
      // Declaring  the property X - Follows a syntax. See the C# quick reference sheet 
      public int Y
      {
          get
          {
              return this.y;
          }
  
          set
          {
              this.y = RangeCheckedY(value);
          }
      }
  }
  </code></pre>
  
  <p>I am getting this error at the "ERROR HERE" comment lines:</p>
  
  <blockquote>
    <p>The 'this' object cannot be used before all of its fields are assigned to</p>
  </blockquote>
  
  <p>Is it illegal to call a structure method in the non-default constructor to assign values to the structure members? </p>