Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- namespace ConsoleApplication1
- {
- public class Program
- {
- public static void Main()
- {
- Outer.Nested.CreateInstance(34);
- Outer.Nested.CreateInstance(5);
- Outer.Nested.CreateInstance(21);
- Console.WriteLine(Outer.Nested.CompareRecord(0, 34));
- }
- }
- public class Outer
- {
- private readonly int _field;
- public Outer(int field)
- {
- _field = field;
- }
- public static class Nested
- {
- private static readonly List<Outer> ListOfNested = new List<Outer>();
- public static void CreateInstance(int input)
- {
- Outer record = new Outer(input);
- ListOfNested.Add(record);
- }
- public static bool CompareRecord(int location, int num)
- => ListOfNested[location]._field == num;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement