Home c# I can not figure out the error name "" does not exist...

I can not figure out the error name “” does not exist in the current context. C # language Help please

Author

Date

Category

This error is issued: the name “LampaAs [i]” does not exist in the current context. Errors that allocated Visual Studio is highlighted with an asterisk (*), more precisely where LampaAs [i] and Lampass [b] is written. C # language I sort objects ascending and everything is sorted by the Public int CapacityLamp {Get; SET; }.

using system;
Namespace laba_6.
{
  Class Lampa: ICOMPARABLE & LT; LAMPA & GT;
  {
    Public String Typelamp {Get; SET; }
    Public int CapacityLamp {Get; SET; }
    Public int c_outlamp {get; SET; }
    Public Lampa (String Typelamp, Int CapacityLamp, Int C_outlamp)
    {
      this.Typelamp = Typelamp;
      this.capacitylamp = CapacityLamp;
      this.c_outlamp = c_outlamp;
    }
    Public int COMPARETO (Lampa P)
    {
      Return this.capacitylamp.compareTo (P.CapacityLamp);
    }
    Class Lamps.
    {
      LAMPA [] LAMPAS = NEW LAMPA [7];
      Public Lampa This [INT POS]
      {
        Get.
        {
          if (POS & GT; = 0 || POS & LT; 7) RETURN LAMPAS [POS];
          ELSE THROW NEW INDEXOUTOFRANGEEXCEPTION ("Outside range!");
        }
        set {lampas [POS] = VALUE; }
      }
    }
    Class Program
    {
      Public Void Print ()
      {
        for (int b = 0; b & lt; 7; b ++)
        {
          Console.WriteLine ($ "Lamp Type: ** {lampaas [b] **. Typelamp}. Power consumption: {** LampaAs [b] **. CapacityLamp} W. Output power {** LampaAs [b] ** .c_outlamp} W. ");
          Console.Writeline ();
        }
      }
      Public void sort_select () // Sort by direct choice
      {
        for (int i = 0; i & lt; 6; i ++)
        {
          int min = i;
          For (int j = i + 1; j & lt; 7; j ++)
          {
            if (** lampaas [i] **. CompareTo (** LampaAs [j] **) & gt; 0)
            {
              MIN = J;
            }
          }
          var temp = ** lampaas [i] **;
          ** lampaas [i] ** = ** lampaas [min] **;
          ** lampaas [min] ** = temp;
        }
      }
      Public Void SortBubble ()
      {
        for (int i = 0; i & lt; 7; i ++)
        {
          For (int j = i + 1; j & lt; 7; j ++)
          {
            if (** lampaas [i] **. CompareTo (** LampaAs [j] **) & gt; 0)
            {
              var t = ** lampaas [i]; **
              ** lampaas [i] ** = ** LampaAs [j] **;
              ** LampaAs [j] ** = t;
            }
          }
        }
      }
      Static Void Main (String [] Args)
      {
        LAMPS LAMPAAS = NEW LAMPS ();
        Lampaas [0] = new lampa ("incandescent", 100, 100);
        Lampaas [1] = New Lampa ("LED", 20, 100);
        Lampaas [2] = new lampa ("luminescent", 50, 100);
        Lampaas [3] = new lampa ("halogen", 150, 150);
        Lampaas [4] = new lampa ("gas-discharge", 110, 150);
        LampaAs [5] = New Lampa ("Energy Saving", 15, 100);
        Lampaas [6] = new lampa ("neon", 250, 350);
        Console.ForeGroundColor = Consolecolor.green;
        PROGRAM SORT = NEW PROGRAM ();
        //sort.print ();
        //sort.sort_select ();
        sort.sortbubble ();
        sort.print ();
        Console.Writeline ();
        sort.sort_select ();
        sort.print ();
        Console.ReadKey ();
      }
    }
  }
}

Answer 1, Authority 100%

static lamps lampaas = new lamps ();
    Static Void Main (String [] Args) 
{
       // Lamps Lampaas = new Lamps ();

Programmers, Start Your Engines!

Why spend time searching for the correct question and then entering your answer when you can find it in a second? That's what CompuTicket is all about! Here you'll find thousands of questions and answers from hundreds of computer languages.

Recent questions