title: How to get value from another class's inside of if-else statements?
body: <p>When I call <code>dnanumber</code> variable from another class it seems <code>0</code> in console. How can I fix this problem?</p>
  
  <pre><code>class DNAgenerator
      {
  
  
  
          public int dnanumber;
  
  
  
          public int dna;
          public int dna2;
          public int dna3;
          public int dna4;
  
  
  
          public void generetor()
          {
  
              Random user = new Random();
  
              dna = user.Next(1,41);
              dna2 = user.Next(1,41);
              dna3 = user.Next(1, 41);
              dna4 = user.Next(1, 41);
  
              Random nukleodite = new Random();
  
  
  
              if (dna == nukleodite.Next(1,11))
              {            
                  dnanumber = 65;
              }
  
                else if(dna== nukleodite.Next(11, 21))
              {
  
                  dnanumber = 67;
               }
               else if (dna == nukleodite.Next(21, 31))
                  {
  
                  dnanumber = 71;
               }
             else if(dna == nukleodite.Next(31,41))
              {
  
                  dnanumber = 84;
              }
  
  
              //   dna2   
  
              if (dna2 == nukleodite.Next(1, 11))
              {
                  dnanumber = 65;
              }
  
              else if (dna2 == nukleodite.Next(11, 21))
              {
                  dnanumber = 67;
              }
              else if (dna2 == nukleodite.Next(21, 31))
              {
                  dnanumber = 71;
              }
              else if (dna2 == nukleodite.Next(31, 41))
              {
                  dnanumber = 84;
              }
  
  
              //dna3
  
  
              if (dna3 == nukleodite.Next(1, 11))
              {
  
              }
  
              else if (dna3 == nukleodite.Next(11, 21))
              {
  
              }
              else if (dna3 == nukleodite.Next(21, 31))
              {
  
              }
              else if (dna3 == nukleodite.Next(31, 41))
              {
  
              }
  
  
              //dna4
  
              if (dna4 == nukleodite.Next(1, 11))
              {
  
              }
  
              else if (dna4 == nukleodite.Next(11, 21))
              {
  
              }
              else if (dna4 == nukleodite.Next(21, 31))
              {
  
              }
              else if (dna4 == nukleodite.Next(31, 41))
              {
  
              }
  
          }
     }
  
  
  static void Main(string[] args)
          {
  
  
  
  
              DNAgenerator user = new DNAgenerator();
  
  
  
  
              user.generetor();
  
  
  
  
  
  
  
              Console.WriteLine(user.dna.ToString() + " " +user.dna2.ToString() + " " + user.dna3.ToString() + " " + user.dna4.ToString() );
  
  
  
  
              Console.ReadKey();
          }
  </code></pre>