title: Assigning values to a public byte array in one line C#
body: <p>I am working with a public byte array and would like to assign values, like I assign arrays inside a method, i.e</p>
  
  <pre><code>byte[] foo = {0x32, 0x00, 0x1E, 0x00};
  </code></pre>
  
  <p>but when I define the values I am forced to do</p>
  
  <pre><code>foo[0] = 0x32;
  foo[1] = 0x00;
  foo[2] = 0x1E;
  foo[3] = 0x00;
  </code></pre>
  
  <p>If I use the first example VS gives an error "Only assignment, call, increment, decrement, await, and new object expressions can be used as a statement"</p>
  
  <p>If it helps any, the array is always 4 bytes.</p>
  
  <p>my code</p>
  
  <pre><code>public byte[] SetSpeed = new byte[4];
  private void trackBar1_Scroll(object sender, EventArgs e)
  {
      if (trackBar1.Value == 0)
      {
          try
          {
              stop = true;
              UpdateSThread.Abort();
              Thread.Sleep(350);
          }
          catch { }
          SetSpeed = {0x00,0x00,0x00,0x00};
          WriteMem(GetPlayer() + STATUS_OFFSET, SetSpeed);
          label1.Text = "Normal";              
      }
  }
  </code></pre>