title: How can I convert data held as 01010 bits into fields in a class object?
body: <p>I have two variables that contain true/false data. THe first variable can be null but the second variable is always non null. Both variables will always be the same length.</p>
  
  <pre><code>var AnswerGridCorrect = "000111"; // or null
  var AnswerGridResponses = "000011";
  </code></pre>
  
  <p>How could I change this data into an object oriented form. I already created classes and these are below. Here's is what I need the output to look like when converted to JSON:</p>
  
  <pre><code>"answers":[        // Json conversion made Answers into answers
     {"correct":null,"response":true},
     {"correct":null,"response":true},
     {"correct":null,"response":true},
     {"correct":null,"response":false}
   }
  </code></pre>
  
  <p>Note that I am using LINQ to output the data so I think what I need is a function with parameters something like this:</p>
  
  <pre><code> .Select((t, index) =&gt; new  {
                  Answer = t.Answer,
                  Answers = makeAnswer(t.AnswerGridCorrect,
                                       t.AnswerGridResponses)
                  });
  </code></pre>
  
  <p>I am not sure if this helps but here were the classes I was using when I did this from JSON:</p>
  
  <pre><code>public class AnswerRow
  {
      public bool? Correct { get; set; }
      public bool Response { get; set; }
  }
  
  public class AnswerRowList
  {
      public IList&lt;AnswerRow&gt; AnswerRows { get; set; }
  }
  </code></pre>