No overload for method 'Add' takes '0' arguments

Status
Niet open voor verdere reacties.

savant11

Gebruiker
Lid geworden
7 jan 2008
Berichten
153
HOi,

heb dit:

Code:
 public Animation GetAnimation(int idx )
        {
            for (int i = 0; i < animation.Count; i++)
                animation.Add();
                //new CharDef();
                //new Animation();
                //animation.Add();
                return (idx >= 0) ? animation[idx]: null;
            return null;

            Animation a = new Animation(100);
            animation.Add(a);
                //MessageBox.Show("Selected Item Text: " + animation[idx].ToString() + "\n" +
                       // "Index: " + animation[idx].ToString());


            return null;

        }

Maar krijg bij deze regel: animation.Add();

De volgende fout:

Error 3 No overload for method 'Add' takes '0' arguments C:\Users\savantKing\

THX
 
probeer dit is, ik weet niet precies wat je wil:
Code:
        public Animation GetAnimation(int idx)
        {
            for (int i = 0; i < animation.Count; i++)
            {
                animation.Add(new Animation(idx));
            }
            return (idx >= 0) ? animation[idx] : null;
        }
 
Hoi Santo2.

waar heb je het over? En heb ik iets aan je opmerking??:rolleyes:
 
Je zegt lijst.VoegToe() (ff int nederlands, miss is dat duidelijker)
maar wat voeg je toe? je moet iets tussen de haakjes zetten.

dus als ik zou zeggen dogs.Add(), dan moet ik dogs.Add(dog) doen.
lijkt me duidelijk?
 
hoi santos2,

komt hier list in voor?

Code:
 public Animation GetAnimation(int idx )
        {
            for (int i = 0; i < animation.Count; i++)
                animation.Add();
                //new CharDef();
                //new Animation();
                //animation.Add();
                return (idx >= 0) ? animation[idx]: null;
            return null;

            Animation a = new Animation(100);
            animation.Add(a);
                //MessageBox.Show("Selected Item Text: " + animation[idx].ToString() + "\n" +
                       // "Index: " + animation[idx].ToString());


            return null;

        }
 
ik veronderstel dat uw Animation een list is?
op een list kan je .Count en .Add doen, en daar staat dus ook duidelijk animation.Add(), zonder een item er in
 
Status
Niet open voor verdere reacties.
Terug
Bovenaan Onderaan