title: Converting an array of Pixels to an image in C#
body: <p>I have an array of <code>int</code> pixels in my C# program and I want to convert it into an image. The problem is I am converting Java source code for a program into equivalent C# code. In java the line reads which displays the array of int pixels into image:</p>
  
  <pre><code>Image output = createImage(new MemoryImageSource(width, height, orig, 0, width));
  </code></pre>
  
  <p><strong>can someone tell me the C# equivalent?</strong></p>
  
  <p>Here orig is the array of <code>int</code> pixels. I searched the Bitmap class and there is a method called <code>SetPixel</code> but the problem is it takes a x,y coordinate number. But what I have in my code is an array of <code>int</code> pixels. Another weird thing is my orig array has negative number and they are way far away from 255. In Java this is the same case (meaning both the array in C# and Java have equivalent value) and the values is working fine in Java.</p>
  
  <p>But I can't get that line translated into C#. Please help.</p>