Guest User

Untitled

a guest
Jan 8th, 2017
179
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4.  
  5. public class Program
  6. {
  7.     public static void Main()
  8.     {
  9.         Outer.CreateInstance(34);
  10.         Outer.CreateInstance(5);
  11.         Outer.CreateInstance(21);
  12.         Console.WriteLine(Outer.CompareRecord(0,34));
  13.     }
  14. }
  15.  
  16. public static class Outer
  17. {
  18.     private static List<Nested> ListOfNested = new List<Nested>();
  19.  
  20.     public static void CreateInstance(int input)
  21.     {
  22.         Nested record = new Nested(input);
  23.         ListOfNested.Add(record);
  24.     }
  25.    
  26.     public static bool CompareRecord(int location, int num)
  27.     {
  28.      // return (ListOfNested[location].Field == num);
  29.         return (ListOfNested[location].field == num);
  30.     }
  31.    
  32.     private class Nested
  33.     {
  34.         int field;
  35.         public Nested(int field)
  36.         {
  37.             this.field = field;
  38.         }
  39.        
  40.          public int Field
  41.          {
  42.                 get {return field;}
  43.          }
  44.     }
  45. }
Advertisement
Add Comment
Please, Sign In to add comment