title: Error CS1061: struct does not contain a definition for 'foo' and no accessible extension method 'foo' could be found
body: <p>I'm a newcomer to C#, trying to learn Unity. I've tried to create a struct, and then extend an IList to contain it, but the struct's members don't seem to be detected. The list is for orders objects in an RTS game.</p>
  <p>You can reproduce this with a new unity project, then creating two .cs files, HasFoo.cs and HasFooList.cs</p>
  <p>HasFoo.cs:</p>
  <pre><code>    using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      public struct HasFoo{
          public int foo;
          public HasFoo(bool constructor_parameter){
              foo = 1;
          }
      }
  </code></pre>
  <p>HasFooList.css:</p>
  <pre><code>    using System.Collections;
      using System.Collections.Generic;
      using UnityEngine;
      
      
      public class HasFooList&lt;HasFoo&gt; : IList&lt;HasFoo&gt;{
          private List&lt;HasFoo&gt; _list = new List&lt;HasFoo&gt;();
      
          public void Add(HasFoo item){
              item.foo = 2;
              this._list.Add(item);
          }
      
          #region Implementation of IEnumerable
      
          public IEnumerator&lt;HasFoo&gt; GetEnumerator()
          {
              return _list.GetEnumerator();
          }
      
          IEnumerator IEnumerable.GetEnumerator()
          {
              return GetEnumerator();
          }
      
          #endregion
      
          #region Implementation of ICollection&lt;HasFoo&gt;
      
          public void Clear()
          {
              _list.Clear();
          }
      
          public bool Contains(HasFoo item)
          {
              return _list.Contains(item);
          }
      
          public void CopyTo(HasFoo[] array, int arrayIndex)
          {
              _list.CopyTo(array, arrayIndex);
          }
      
          public bool Remove(HasFoo item)
          {
              return _list.Remove(item);
          }
      
          public int Count
          {
              get { return _list.Count; }
          }
      
          public bool IsReadOnly
          {
              get { return _list.IsReadOnly; }
      
          }
      
          #endregion
      
          #region Implementation of IList&lt;HasFoo&gt;
      
          public int IndexOf(HasFoo item)
          {
              return _list.IndexOf(item);
          }
      
          public void Insert(int index, HasFoo item)
          {
              _list.Insert(index, item);
          }
      
          public void RemoveAt(int index)
          {
              _list.RemoveAt(index);
          }
      
          public HasFoo this[int index]
          {
              get { return _list[index]; }
              set { _list[index] = value; }
          }
      
          #endregion
      
      }
  </code></pre>
  <p>I get the following error messages:</p>
  <blockquote>
  <p>Assets/HasFooList.cs(10,14): error CS1061: 'HasFoo' does not contain a definition for 'foo' and no accessible extension method 'foo' accepting a first argument of type 'HasFoo' could be found (are you missing a using directive or an assembly reference?)</p>
  <p>Assets/HasFooList.cs(57,28): error CS1061: 'List' does not contain a definition for 'IsReadOnly' and no accessible extension method 'IsReadOnly' accepting a first argument of type 'List' could be found (are you missing a using directive or an assembly reference?)</p>
  </blockquote>
  <p>If I change <code>HasFooList</code>'s <code>IsReadOnly</code> to simply return false, that error goes away, but obviously isn't ideal.</p>