C#
C#

help

Root Question Message

Ted Bunny
Ted Bunny8/23/2022
Abstract List of KeyValuePairs

public abstract List<KeyValuePair<string, int>> inventory;

It says I can't do this with a field, and to try a property instead. Doing that doesn't resolve it.

I've never received this message when declaring an abstract variable. Any suggestions?
Message Not Public

Sign In and Join Server To See

8/23/2022
Message Not Public

Sign In and Join Server To See

8/23/2022
Message Not Public

Sign In and Join Server To See

8/23/2022
Ted Bunny
Ted Bunny8/23/2022
Ah ok, I forgot the {get;}
Ted Bunny
Ted Bunny8/23/2022
Adding that does what I needed. Thanks!
jcotton42
jcotton428/23/2022
abstract is "this member needs to be implemented by deriving classes"
Fields don't have implementations, they just exist
jcotton42
jcotton428/23/2022
Also, why a List of KVP instead of a dictionary?
Ted Bunny
Ted Bunny8/23/2022
I need non-unique keys
Message Not Public

Sign In and Join Server To See

8/23/2022
Ted Bunny
Ted Bunny8/23/2022
I used the auto-suggested version, I forget what it looked like
Ted Bunny
Ted Bunny8/23/2022
Is there a better structure than List<KVP>? I've never used it before
Message Not Public

Sign In and Join Server To See

8/23/2022
Ted Bunny
Ted Bunny8/23/2022
Yeah, I'm really not liking the clunky syntax of the KVP stuff. I'll give that a shot.
Ted Bunny
Ted Bunny8/23/2022
Thanks, all!
ContactFrequently Asked QuestionsJoin The DiscordBugs & Feature RequestsTerms & Privacy