Numbers unable to be added into a List.NET String.Format() to add commas in thousands place for a numberWhat are the correct version numbers for C#?Randomize a List<T>Random number generator only generating one random numberMultiple updatepanels --> loading and displaying one by oneCalculate difference between two dates (number of days)?How do I generate a random int number?How to Sort a List<T> by a property in the objectError - Unable to access the IIS metabaseWhy not inherit from List<T>?

Is a diamond sword feasible?

Cropping a message using array splits

Washer drain pipe overflow

What can cause a never-frozen indoor copper drain pipe to crack?

How did Thanos not realise this had happened at the end of Endgame?

On what legal basis did the UK remove the 'European Union' from its passport?

Are there variations of the regular runtimes of the Big-O-Notation?

Was there a contingency plan in place if Little Boy failed to detonate?

The lexical root of the perfect tense forms differs from the lexical root of the infinitive form

histogram using edges

Will change of address affect direct deposit?

Is the schwa sound consistent?

Is it a bad idea to replace pull-up resistors with hard pull-ups?

Two researchers want to work on the same extension to my paper. Who to help?

about the word 地図

find not returning expected files

How does Howard Stark know this?

"Right on the tip of my tongue" meaning?

Best species to breed to intelligence

How could we transfer large amounts of energy sourced in space to Earth?

Understanding basic photoresistor circuit

How could a Lich maintain the appearance of being alive without magic?

How do I compare the result of "1d20+x, with advantage" to "1d20+y, without advantage", assuming x < y?

How can this pool heater gas line be disconnected?



Numbers unable to be added into a List


.NET String.Format() to add commas in thousands place for a numberWhat are the correct version numbers for C#?Randomize a List<T>Random number generator only generating one random numberMultiple updatepanels --> loading and displaying one by oneCalculate difference between two dates (number of days)?How do I generate a random int number?How to Sort a List<T> by a property in the objectError - Unable to access the IIS metabaseWhy not inherit from List<T>?






.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;








1















I am trying to store the elements that are given in the main function into the list from textinput class and echo it out. The numeric input class is to filter the elements that are being stored to be of numeric values only. I want the output to be just 10 as the purpose of numeric input class is to filter out the letter 'a'. However, I got some errors such as end of file expected and missing "" and "". I checked if i had missed out some of these but i couldn't find any missing ones. Also, am I doing this right because I am new to the language and I need some advice on how to correct and improve it. Thank You.



EDIT: I have edited my code with the feedbacks that I have gotten and some new error messages appeared. Errors such as:-




The name 'add_char' does not exist in the current context.



The type or namespace name 'List<>' could not be found.



'TextInput' does not contain a definition for 'c' and no extension method 'c' accepting a first argument of type 'TextInput' could be found




EDIT2: So after importing the System.Collections.Generic and changing the list to protected, I encountered other errors as shown in the screenshot:-
Error Messages



Code:



using System;
using System.Collections.Generic;

public class TextInput

protected List<char> add_char = new List<char>();

public void Add(char c)

add_char.Add(c);



public string GetValue()

for (add_char.size = 0; add_char.size < 400; add_char.size++)

return c;






public class NumericInput:TextInput

public new void Add(char c)

if(char.IsNumber(c))

add_char.Add(c);

else

Console.WriteLine("This is not a number");







public class UserInput

public static void Main(string[] args)

TextInput input = new NumericInput();
input.Add('1');
input.Add('a');
input.Add('0');
Console.WriteLine(input.GetValue());











share|improve this question



















  • 2





    The code will not compile -) extends is not available in C# instead you can use :

    – Prashant Pimpale
    Mar 23 at 11:07












  • I am requesting you to explain the question well. There are still better ways to do this :)

    – Prashant Pimpale
    Mar 23 at 11:15











  • I have gotten into some error after making modifications to the code. I edited the post and have written out the new error messages. Thanks

    – lol
    Mar 23 at 11:20











  • using System.Collections.Generic to avoid <The type or namespace name 'List<>' could not be found.>

    – Roman Ieromenko
    Mar 23 at 11:45

















1















I am trying to store the elements that are given in the main function into the list from textinput class and echo it out. The numeric input class is to filter the elements that are being stored to be of numeric values only. I want the output to be just 10 as the purpose of numeric input class is to filter out the letter 'a'. However, I got some errors such as end of file expected and missing "" and "". I checked if i had missed out some of these but i couldn't find any missing ones. Also, am I doing this right because I am new to the language and I need some advice on how to correct and improve it. Thank You.



EDIT: I have edited my code with the feedbacks that I have gotten and some new error messages appeared. Errors such as:-




The name 'add_char' does not exist in the current context.



The type or namespace name 'List<>' could not be found.



'TextInput' does not contain a definition for 'c' and no extension method 'c' accepting a first argument of type 'TextInput' could be found




EDIT2: So after importing the System.Collections.Generic and changing the list to protected, I encountered other errors as shown in the screenshot:-
Error Messages



Code:



using System;
using System.Collections.Generic;

public class TextInput

protected List<char> add_char = new List<char>();

public void Add(char c)

add_char.Add(c);



public string GetValue()

for (add_char.size = 0; add_char.size < 400; add_char.size++)

return c;






public class NumericInput:TextInput

public new void Add(char c)

if(char.IsNumber(c))

add_char.Add(c);

else

Console.WriteLine("This is not a number");







public class UserInput

public static void Main(string[] args)

TextInput input = new NumericInput();
input.Add('1');
input.Add('a');
input.Add('0');
Console.WriteLine(input.GetValue());











share|improve this question



















  • 2





    The code will not compile -) extends is not available in C# instead you can use :

    – Prashant Pimpale
    Mar 23 at 11:07












  • I am requesting you to explain the question well. There are still better ways to do this :)

    – Prashant Pimpale
    Mar 23 at 11:15











  • I have gotten into some error after making modifications to the code. I edited the post and have written out the new error messages. Thanks

    – lol
    Mar 23 at 11:20











  • using System.Collections.Generic to avoid <The type or namespace name 'List<>' could not be found.>

    – Roman Ieromenko
    Mar 23 at 11:45













1












1








1








I am trying to store the elements that are given in the main function into the list from textinput class and echo it out. The numeric input class is to filter the elements that are being stored to be of numeric values only. I want the output to be just 10 as the purpose of numeric input class is to filter out the letter 'a'. However, I got some errors such as end of file expected and missing "" and "". I checked if i had missed out some of these but i couldn't find any missing ones. Also, am I doing this right because I am new to the language and I need some advice on how to correct and improve it. Thank You.



EDIT: I have edited my code with the feedbacks that I have gotten and some new error messages appeared. Errors such as:-




The name 'add_char' does not exist in the current context.



The type or namespace name 'List<>' could not be found.



'TextInput' does not contain a definition for 'c' and no extension method 'c' accepting a first argument of type 'TextInput' could be found




EDIT2: So after importing the System.Collections.Generic and changing the list to protected, I encountered other errors as shown in the screenshot:-
Error Messages



Code:



using System;
using System.Collections.Generic;

public class TextInput

protected List<char> add_char = new List<char>();

public void Add(char c)

add_char.Add(c);



public string GetValue()

for (add_char.size = 0; add_char.size < 400; add_char.size++)

return c;






public class NumericInput:TextInput

public new void Add(char c)

if(char.IsNumber(c))

add_char.Add(c);

else

Console.WriteLine("This is not a number");







public class UserInput

public static void Main(string[] args)

TextInput input = new NumericInput();
input.Add('1');
input.Add('a');
input.Add('0');
Console.WriteLine(input.GetValue());











share|improve this question
















I am trying to store the elements that are given in the main function into the list from textinput class and echo it out. The numeric input class is to filter the elements that are being stored to be of numeric values only. I want the output to be just 10 as the purpose of numeric input class is to filter out the letter 'a'. However, I got some errors such as end of file expected and missing "" and "". I checked if i had missed out some of these but i couldn't find any missing ones. Also, am I doing this right because I am new to the language and I need some advice on how to correct and improve it. Thank You.



EDIT: I have edited my code with the feedbacks that I have gotten and some new error messages appeared. Errors such as:-




The name 'add_char' does not exist in the current context.



The type or namespace name 'List<>' could not be found.



'TextInput' does not contain a definition for 'c' and no extension method 'c' accepting a first argument of type 'TextInput' could be found




EDIT2: So after importing the System.Collections.Generic and changing the list to protected, I encountered other errors as shown in the screenshot:-
Error Messages



Code:



using System;
using System.Collections.Generic;

public class TextInput

protected List<char> add_char = new List<char>();

public void Add(char c)

add_char.Add(c);



public string GetValue()

for (add_char.size = 0; add_char.size < 400; add_char.size++)

return c;






public class NumericInput:TextInput

public new void Add(char c)

if(char.IsNumber(c))

add_char.Add(c);

else

Console.WriteLine("This is not a number");







public class UserInput

public static void Main(string[] args)

TextInput input = new NumericInput();
input.Add('1');
input.Add('a');
input.Add('0');
Console.WriteLine(input.GetValue());








c#






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 23 at 12:55







lol

















asked Mar 23 at 11:04









lollol

215




215







  • 2





    The code will not compile -) extends is not available in C# instead you can use :

    – Prashant Pimpale
    Mar 23 at 11:07












  • I am requesting you to explain the question well. There are still better ways to do this :)

    – Prashant Pimpale
    Mar 23 at 11:15











  • I have gotten into some error after making modifications to the code. I edited the post and have written out the new error messages. Thanks

    – lol
    Mar 23 at 11:20











  • using System.Collections.Generic to avoid <The type or namespace name 'List<>' could not be found.>

    – Roman Ieromenko
    Mar 23 at 11:45












  • 2





    The code will not compile -) extends is not available in C# instead you can use :

    – Prashant Pimpale
    Mar 23 at 11:07












  • I am requesting you to explain the question well. There are still better ways to do this :)

    – Prashant Pimpale
    Mar 23 at 11:15











  • I have gotten into some error after making modifications to the code. I edited the post and have written out the new error messages. Thanks

    – lol
    Mar 23 at 11:20











  • using System.Collections.Generic to avoid <The type or namespace name 'List<>' could not be found.>

    – Roman Ieromenko
    Mar 23 at 11:45







2




2





The code will not compile -) extends is not available in C# instead you can use :

– Prashant Pimpale
Mar 23 at 11:07






The code will not compile -) extends is not available in C# instead you can use :

– Prashant Pimpale
Mar 23 at 11:07














I am requesting you to explain the question well. There are still better ways to do this :)

– Prashant Pimpale
Mar 23 at 11:15





I am requesting you to explain the question well. There are still better ways to do this :)

– Prashant Pimpale
Mar 23 at 11:15













I have gotten into some error after making modifications to the code. I edited the post and have written out the new error messages. Thanks

– lol
Mar 23 at 11:20





I have gotten into some error after making modifications to the code. I edited the post and have written out the new error messages. Thanks

– lol
Mar 23 at 11:20













using System.Collections.Generic to avoid <The type or namespace name 'List<>' could not be found.>

– Roman Ieromenko
Mar 23 at 11:45





using System.Collections.Generic to avoid <The type or namespace name 'List<>' could not be found.>

– Roman Ieromenko
Mar 23 at 11:45












2 Answers
2






active

oldest

votes


















1














This line prevents it from being added to list as char is never is a int (char and int are different types):



if(GetValue(this.c).GetType() == typeof(int)){


instead change it to:



if(char.IsNumber(c)) add_char.Add(c);





share|improve this answer






























    1















    The name 'add_char' does not exist in the current context.




    Because it doesn't. add_char is a local variable declared in the Add method of your TextInput class. Local variables can only be used in the method scope in which they're declared. You're trying to use it in a different method (the Add method of your NumericInput class). Perhaps you meant to declare it at the class level in TextInput?:



    protected List<char> add_char = new List<char>();

    public void Add(char c)

    //...




    The type or namespace name 'List<>' could not be found.




    Add using System.Collections.Generic; at the top of the file. Note also that Visual Studio helps you with this. If you place your cursor or hover your mouse in the use of List<> then a tooltip should show (with a little light bulb) to help correct the error.




    'TextInput' does not contain a definition for 'c' and no extension method 'c' accepting a first argument of type 'TextInput' could be found




    Because it doesn't. c is a local variable declared in the Add method of your TextInput class. Local variables can only be used in the method scope in which they're declared. When someone calls GetValue(), what exactly are you wanting to return? That method has no variables. With the above change you can move add_char to the class level, then that method can access it.






    share|improve this answer























    • So are you saying that the Add method should be converted into a class inside the textinput class? Also after implementing the using System.Collections.Generic; and making the list protected, a list of errors is showing instead.

      – lol
      Mar 23 at 12:09












    • I have edited the post to show the new errors.

      – lol
      Mar 23 at 12:15











    • @lol: "So are you saying that the Add method should be converted into a class" - Not at all. As for the new errors, you're trying to use the protected keyword inside a method which is throwing off the parsing. To make something a class-level member, it needs to be declared in the class instead of in a method, just as demonstrated in this answer.

      – David
      Mar 23 at 12:18











    • So i've made the add_char list to a class-level, but it shows the same error message where the textinput class does not contain a definition for 'c' for my getValue method. Am i returning it wrongly?

      – lol
      Mar 23 at 12:29












    • @lol: Because your GetValue method doesn't have a variable called c. It doesn't have any variable. Take a step back for a moment. Instead of randomly moving code around until something compiles, define what you logically want your methods to do. Conceptually, what should GetValue return?

      – David
      Mar 23 at 12:31











    Your Answer






    StackExchange.ifUsing("editor", function ()
    StackExchange.using("externalEditor", function ()
    StackExchange.using("snippets", function ()
    StackExchange.snippets.init();
    );
    );
    , "code-snippets");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "1"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: true,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: 10,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55313029%2fnumbers-unable-to-be-added-into-a-list%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    2 Answers
    2






    active

    oldest

    votes








    2 Answers
    2






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    1














    This line prevents it from being added to list as char is never is a int (char and int are different types):



    if(GetValue(this.c).GetType() == typeof(int)){


    instead change it to:



    if(char.IsNumber(c)) add_char.Add(c);





    share|improve this answer



























      1














      This line prevents it from being added to list as char is never is a int (char and int are different types):



      if(GetValue(this.c).GetType() == typeof(int)){


      instead change it to:



      if(char.IsNumber(c)) add_char.Add(c);





      share|improve this answer

























        1












        1








        1







        This line prevents it from being added to list as char is never is a int (char and int are different types):



        if(GetValue(this.c).GetType() == typeof(int)){


        instead change it to:



        if(char.IsNumber(c)) add_char.Add(c);





        share|improve this answer













        This line prevents it from being added to list as char is never is a int (char and int are different types):



        if(GetValue(this.c).GetType() == typeof(int)){


        instead change it to:



        if(char.IsNumber(c)) add_char.Add(c);






        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 23 at 11:09









        Ashkan Mobayen KhiabaniAshkan Mobayen Khiabani

        23.6k1868125




        23.6k1868125























            1















            The name 'add_char' does not exist in the current context.




            Because it doesn't. add_char is a local variable declared in the Add method of your TextInput class. Local variables can only be used in the method scope in which they're declared. You're trying to use it in a different method (the Add method of your NumericInput class). Perhaps you meant to declare it at the class level in TextInput?:



            protected List<char> add_char = new List<char>();

            public void Add(char c)

            //...




            The type or namespace name 'List<>' could not be found.




            Add using System.Collections.Generic; at the top of the file. Note also that Visual Studio helps you with this. If you place your cursor or hover your mouse in the use of List<> then a tooltip should show (with a little light bulb) to help correct the error.




            'TextInput' does not contain a definition for 'c' and no extension method 'c' accepting a first argument of type 'TextInput' could be found




            Because it doesn't. c is a local variable declared in the Add method of your TextInput class. Local variables can only be used in the method scope in which they're declared. When someone calls GetValue(), what exactly are you wanting to return? That method has no variables. With the above change you can move add_char to the class level, then that method can access it.






            share|improve this answer























            • So are you saying that the Add method should be converted into a class inside the textinput class? Also after implementing the using System.Collections.Generic; and making the list protected, a list of errors is showing instead.

              – lol
              Mar 23 at 12:09












            • I have edited the post to show the new errors.

              – lol
              Mar 23 at 12:15











            • @lol: "So are you saying that the Add method should be converted into a class" - Not at all. As for the new errors, you're trying to use the protected keyword inside a method which is throwing off the parsing. To make something a class-level member, it needs to be declared in the class instead of in a method, just as demonstrated in this answer.

              – David
              Mar 23 at 12:18











            • So i've made the add_char list to a class-level, but it shows the same error message where the textinput class does not contain a definition for 'c' for my getValue method. Am i returning it wrongly?

              – lol
              Mar 23 at 12:29












            • @lol: Because your GetValue method doesn't have a variable called c. It doesn't have any variable. Take a step back for a moment. Instead of randomly moving code around until something compiles, define what you logically want your methods to do. Conceptually, what should GetValue return?

              – David
              Mar 23 at 12:31















            1















            The name 'add_char' does not exist in the current context.




            Because it doesn't. add_char is a local variable declared in the Add method of your TextInput class. Local variables can only be used in the method scope in which they're declared. You're trying to use it in a different method (the Add method of your NumericInput class). Perhaps you meant to declare it at the class level in TextInput?:



            protected List<char> add_char = new List<char>();

            public void Add(char c)

            //...




            The type or namespace name 'List<>' could not be found.




            Add using System.Collections.Generic; at the top of the file. Note also that Visual Studio helps you with this. If you place your cursor or hover your mouse in the use of List<> then a tooltip should show (with a little light bulb) to help correct the error.




            'TextInput' does not contain a definition for 'c' and no extension method 'c' accepting a first argument of type 'TextInput' could be found




            Because it doesn't. c is a local variable declared in the Add method of your TextInput class. Local variables can only be used in the method scope in which they're declared. When someone calls GetValue(), what exactly are you wanting to return? That method has no variables. With the above change you can move add_char to the class level, then that method can access it.






            share|improve this answer























            • So are you saying that the Add method should be converted into a class inside the textinput class? Also after implementing the using System.Collections.Generic; and making the list protected, a list of errors is showing instead.

              – lol
              Mar 23 at 12:09












            • I have edited the post to show the new errors.

              – lol
              Mar 23 at 12:15











            • @lol: "So are you saying that the Add method should be converted into a class" - Not at all. As for the new errors, you're trying to use the protected keyword inside a method which is throwing off the parsing. To make something a class-level member, it needs to be declared in the class instead of in a method, just as demonstrated in this answer.

              – David
              Mar 23 at 12:18











            • So i've made the add_char list to a class-level, but it shows the same error message where the textinput class does not contain a definition for 'c' for my getValue method. Am i returning it wrongly?

              – lol
              Mar 23 at 12:29












            • @lol: Because your GetValue method doesn't have a variable called c. It doesn't have any variable. Take a step back for a moment. Instead of randomly moving code around until something compiles, define what you logically want your methods to do. Conceptually, what should GetValue return?

              – David
              Mar 23 at 12:31













            1












            1








            1








            The name 'add_char' does not exist in the current context.




            Because it doesn't. add_char is a local variable declared in the Add method of your TextInput class. Local variables can only be used in the method scope in which they're declared. You're trying to use it in a different method (the Add method of your NumericInput class). Perhaps you meant to declare it at the class level in TextInput?:



            protected List<char> add_char = new List<char>();

            public void Add(char c)

            //...




            The type or namespace name 'List<>' could not be found.




            Add using System.Collections.Generic; at the top of the file. Note also that Visual Studio helps you with this. If you place your cursor or hover your mouse in the use of List<> then a tooltip should show (with a little light bulb) to help correct the error.




            'TextInput' does not contain a definition for 'c' and no extension method 'c' accepting a first argument of type 'TextInput' could be found




            Because it doesn't. c is a local variable declared in the Add method of your TextInput class. Local variables can only be used in the method scope in which they're declared. When someone calls GetValue(), what exactly are you wanting to return? That method has no variables. With the above change you can move add_char to the class level, then that method can access it.






            share|improve this answer














            The name 'add_char' does not exist in the current context.




            Because it doesn't. add_char is a local variable declared in the Add method of your TextInput class. Local variables can only be used in the method scope in which they're declared. You're trying to use it in a different method (the Add method of your NumericInput class). Perhaps you meant to declare it at the class level in TextInput?:



            protected List<char> add_char = new List<char>();

            public void Add(char c)

            //...




            The type or namespace name 'List<>' could not be found.




            Add using System.Collections.Generic; at the top of the file. Note also that Visual Studio helps you with this. If you place your cursor or hover your mouse in the use of List<> then a tooltip should show (with a little light bulb) to help correct the error.




            'TextInput' does not contain a definition for 'c' and no extension method 'c' accepting a first argument of type 'TextInput' could be found




            Because it doesn't. c is a local variable declared in the Add method of your TextInput class. Local variables can only be used in the method scope in which they're declared. When someone calls GetValue(), what exactly are you wanting to return? That method has no variables. With the above change you can move add_char to the class level, then that method can access it.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 23 at 11:45









            DavidDavid

            152k29149216




            152k29149216












            • So are you saying that the Add method should be converted into a class inside the textinput class? Also after implementing the using System.Collections.Generic; and making the list protected, a list of errors is showing instead.

              – lol
              Mar 23 at 12:09












            • I have edited the post to show the new errors.

              – lol
              Mar 23 at 12:15











            • @lol: "So are you saying that the Add method should be converted into a class" - Not at all. As for the new errors, you're trying to use the protected keyword inside a method which is throwing off the parsing. To make something a class-level member, it needs to be declared in the class instead of in a method, just as demonstrated in this answer.

              – David
              Mar 23 at 12:18











            • So i've made the add_char list to a class-level, but it shows the same error message where the textinput class does not contain a definition for 'c' for my getValue method. Am i returning it wrongly?

              – lol
              Mar 23 at 12:29












            • @lol: Because your GetValue method doesn't have a variable called c. It doesn't have any variable. Take a step back for a moment. Instead of randomly moving code around until something compiles, define what you logically want your methods to do. Conceptually, what should GetValue return?

              – David
              Mar 23 at 12:31

















            • So are you saying that the Add method should be converted into a class inside the textinput class? Also after implementing the using System.Collections.Generic; and making the list protected, a list of errors is showing instead.

              – lol
              Mar 23 at 12:09












            • I have edited the post to show the new errors.

              – lol
              Mar 23 at 12:15











            • @lol: "So are you saying that the Add method should be converted into a class" - Not at all. As for the new errors, you're trying to use the protected keyword inside a method which is throwing off the parsing. To make something a class-level member, it needs to be declared in the class instead of in a method, just as demonstrated in this answer.

              – David
              Mar 23 at 12:18











            • So i've made the add_char list to a class-level, but it shows the same error message where the textinput class does not contain a definition for 'c' for my getValue method. Am i returning it wrongly?

              – lol
              Mar 23 at 12:29












            • @lol: Because your GetValue method doesn't have a variable called c. It doesn't have any variable. Take a step back for a moment. Instead of randomly moving code around until something compiles, define what you logically want your methods to do. Conceptually, what should GetValue return?

              – David
              Mar 23 at 12:31
















            So are you saying that the Add method should be converted into a class inside the textinput class? Also after implementing the using System.Collections.Generic; and making the list protected, a list of errors is showing instead.

            – lol
            Mar 23 at 12:09






            So are you saying that the Add method should be converted into a class inside the textinput class? Also after implementing the using System.Collections.Generic; and making the list protected, a list of errors is showing instead.

            – lol
            Mar 23 at 12:09














            I have edited the post to show the new errors.

            – lol
            Mar 23 at 12:15





            I have edited the post to show the new errors.

            – lol
            Mar 23 at 12:15













            @lol: "So are you saying that the Add method should be converted into a class" - Not at all. As for the new errors, you're trying to use the protected keyword inside a method which is throwing off the parsing. To make something a class-level member, it needs to be declared in the class instead of in a method, just as demonstrated in this answer.

            – David
            Mar 23 at 12:18





            @lol: "So are you saying that the Add method should be converted into a class" - Not at all. As for the new errors, you're trying to use the protected keyword inside a method which is throwing off the parsing. To make something a class-level member, it needs to be declared in the class instead of in a method, just as demonstrated in this answer.

            – David
            Mar 23 at 12:18













            So i've made the add_char list to a class-level, but it shows the same error message where the textinput class does not contain a definition for 'c' for my getValue method. Am i returning it wrongly?

            – lol
            Mar 23 at 12:29






            So i've made the add_char list to a class-level, but it shows the same error message where the textinput class does not contain a definition for 'c' for my getValue method. Am i returning it wrongly?

            – lol
            Mar 23 at 12:29














            @lol: Because your GetValue method doesn't have a variable called c. It doesn't have any variable. Take a step back for a moment. Instead of randomly moving code around until something compiles, define what you logically want your methods to do. Conceptually, what should GetValue return?

            – David
            Mar 23 at 12:31





            @lol: Because your GetValue method doesn't have a variable called c. It doesn't have any variable. Take a step back for a moment. Instead of randomly moving code around until something compiles, define what you logically want your methods to do. Conceptually, what should GetValue return?

            – David
            Mar 23 at 12:31

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Stack Overflow!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55313029%2fnumbers-unable-to-be-added-into-a-list%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            Kamusi Yaliyomo Aina za kamusi | Muundo wa kamusi | Faida za kamusi | Dhima ya picha katika kamusi | Marejeo | Tazama pia | Viungo vya nje | UrambazajiKuhusu kamusiGo-SwahiliWiki-KamusiKamusi ya Kiswahili na Kiingerezakuihariri na kuongeza habari

            SQL error code 1064 with creating Laravel foreign keysForeign key constraints: When to use ON UPDATE and ON DELETEDropping column with foreign key Laravel error: General error: 1025 Error on renameLaravel SQL Can't create tableLaravel Migration foreign key errorLaravel php artisan migrate:refresh giving a syntax errorSQLSTATE[42S01]: Base table or view already exists or Base table or view already exists: 1050 Tableerror in migrating laravel file to xampp serverSyntax error or access violation: 1064:syntax to use near 'unsigned not null, modelName varchar(191) not null, title varchar(191) not nLaravel cannot create new table field in mysqlLaravel 5.7:Last migration creates table but is not registered in the migration table

            은진 송씨 목차 역사 본관 분파 인물 조선 왕실과의 인척 관계 집성촌 항렬자 인구 같이 보기 각주 둘러보기 메뉴은진 송씨세종실록 149권, 지리지 충청도 공주목 은진현