Monday 15 August 2011

c# - Add a value to dictionary within a dictionary error -


I am using the following code:

  private dictionary & lt; String, user & gt; Total Users = New Dictionary & lt; String, user & gt; ();   

Part of the "user" category

  personal dictionary & lt; DateTime, String & gt; KillerField; Public dictionary & lt; Date time, string & gt; The killed players (get {this.killerField;} set {this.killerField = value;}}   

How am I trying to do this action

  Total users [playerName] .killedPlayers.Add (DateTime.Now, die);   

But I'm getting an error:

  " Object reference is not set to an object instance "  

Why is not it working?

Thanks in advance.

get you a killerfield Defeat Before You Can Add Addition Anything at the point of adding a player, it is still using the new dictionary & lt; date time, string & gt; ()

You can do this as part of the announcement or alternatively in the class creator.

No comments:

Post a Comment