title: C# params with a required minimum of one value
body: <p>Is there a more elegant way of ensuring a constructor is always called with at least one value than what I've got here? I have done it this way as I want a compiler error if no values are provided.</p>
  
  
  
  <pre><code>public class MyClass
  {
      private readonly List&lt;string&gt; _things = new List&lt;string&gt;();
      public string[] Things { get { return _things.ToArray(); } }
  
      public MyClass(string thing, params string[] things)
      {
          _things.Add(thing);
          _things.AddRange(things);
      }
  }
  </code></pre>
  
  <p><strong>EDIT</strong></p>
  
  <p>Based on the comments, I have changed the code to this ...</p>
  
  
  
  <pre><code>public class Hypermedia : Attribute
  {
      private readonly Rel[] _relations;
      public IEnumerable&lt;Rel&gt; Relations { get { return _relations; } }
  
      public Hypermedia(Rel relation, params Rel[] relations)
      {
          var list = new List&lt;Rel&gt; {relation};
          list.AddRange(relations);
          _relations = list.ToArray();
      }
  }
  </code></pre>
  
  <p>Apologies for editing the code before in an attempt to hide what I was trying to do. It's easier to just paste straight from my code editor!</p>