Marty Habicht

Marty Habicht

  • NA
  • 3
  • 1.4k

Dictionary with a Point!!

Mar 15 2012 2:56 PM
Hi all,
I hope someone can help me out!! I'm fairly new to C#.

I've established a dictionary:
  Dictionary<string, Point> addPositionDict = new Dictionary<string, Point>();
 
I initialized the dictionary:
 
  Point addPoint = new Point();
  addPoint.X = 0;
  addPoint.Y = 0;
 
and added my points with their given names:
 
  addPositionDict.Add(name_Out, addPoint);
 
Now knowing their names, I want to update their positions and I tried like so:
 
 addPositionDict[nameOut].X = x_matrix;
 
However there is an error which I can't understand:
"Cannot modify the return value of 'System.Collections.Generic.Dictionary<string, System.Drawing.Point>.this[string]' because it is not a variable"
What am I doing wrong? what exactly is not a variable? Again, Take it easy on the language "jargon" -- I'm fairly new to C#.


Answers (2)