Jump to content

found one error and dont know how to correct

- - - - -

This topic has been archived. This means that you cannot reply to this topic.
3 replies to this topic

#1
maidos

maidos

    Newbie

  • Members
  • Pip
  • 1 posts
im using visual studio and have ongoing school project so bare with me as im a newbie at this language.
basically a console for hamburger program where ucan search and add but for some reason its giving me error on public static list<HamList> saying list not found :S

using System;

using System.Collections.Generic;

using System.Text;

using System.IO;


namespace SuperSizeMe

{

    public class HamList

    {


        public HamList(string Namn, string Drycka, string Pommes, int kostnad)

        {

            this.Namn = Namn;

            this.Drycka = Drycka;

            this.genre = Pommes;

            this.kostnad = kostnad;

        }

    }


    public class Program

    {

        public static list<HamList> skiva = new list<HamList>();


        public static void Main(string[] args)

        {

            MainMenu();

            taListan();

            Console.ReadLine();

            StreamWriter utfil = new StreamWriter("lager.txt");

            list.ForEach(delegate(taListan k)

            { utfil.WriteLine(k.Namn + utfil.NewLine + k.Drycka + utfil.Pommes + k.kostnad); });

            utfil.Close();

        }

        public static void MainMenu()

        {

            int funktion;

            Console.WriteLine("\n main menu");

            Console.WriteLine(" 1. söka hamburgare");

            Console.WriteLine(" 2. lista alla hamburgare ut");

            Console.WriteLine(" 3. mata in nya hamburgare");

            Console.WriteLine(" 4. ta mig härifrån");

            Console.Write(" Ditt val---> ");

            while (!int.TryParse(Console.ReadLine(), out funktion) || funktion < 0 || funktion > 3)

            {

                Console.WriteLine(" obs!... se upp funktioner och försök igen");

                Console.Write(" Ditt val---> ");

            }

            Console.Clear();

            Console.ReadLine();

            if(funktion == 1)

            {

                sök();

            }

            else if (funktion == 2)

            {

                listaUt();

            }

        }

        public static void sök()

        { 

        }

        public static void listaUt()

        {

        }

    }


}



#2
lobo521

lobo521

    Learning Programmer

  • Members
  • PipPipPip
  • 57 posts
It should be:
public static List<HamList> skiva = new List<HamList>();
not:
public static list<HamList> skiva = new list<HamList>();

#3
gokuajmes

gokuajmes

    Programming God

  • Members
  • PipPipPipPipPipPipPip
  • 518 posts
what is your native language !
as said before its
public static List <HamList> Skiva = new List<HamList> ( );

Say how did you get the code to syntax highlighted !:confused:

#4
Vswe

Vswe

    Writes binary right handed and hex left handed

  • Members
  • PipPipPipPipPipPipPipPipPip
  • 9,552 posts
He used the [noparse]
 and 
[/noparse] tags and th language is Swedish :)