title: Accesing a member directly by the class name
body: <p>Im trying to create a ufloat class/struct in c#. It's more of a challenge for me, but would help me control some values in code. After trying a couple of approaches, I finally have one that seems to work:</p>
  
  <pre><code>public struct ufloat
  {
      public float Value
      {
          get{ return value; }
          set
          {
              if(value &lt; 0)
              {
                  this.value = 0;
              }
              else
              {
                  this.value = Math.Abs(value);
              }
          }
      }
  }
  </code></pre>
  
  <p>The problem is, I want it to behave like a typical basic type:</p>
  
  <pre><code>ufloat n = 5;
  n += 1;
  </code></pre>
  
  <p>After some thinking I tried to overload the '=' operator, but it is not possible. Now I am out of ideas. This is why I ask, how can you change this:</p>
  
  <pre><code>ufloat x; x.value = 1;
  </code></pre>
  
  <p>to this:</p>
  
  <pre><code>ufloat x = 0; x = 1;
  </code></pre>
  
  <p>?</p>
  
  <p>(Sorry if I am losing something really easy, but I am a self-taught "programmer" and I am pretty new to c#. I learnt c++ at first, and going from lower to higher level isn't easy for me.)</p>