Assign value into Dictionary that has a key type of <Tuple<int,int> C# -


I am writing code to generate a grid which is a graphical editor containing grid values ​​in a dictionary It is my method that I am working with you, to give an idea about this is the way to create your dictionary object.

  public dictionary & lt; Tupal & lt; Int, int>, string & gt; Generate GenerationTable (int _x, int_y) {int total = _x * _y; Var Grid = New Dictionary & lt; Tuple & lt; Int, int>, string & gt; (); //! It is needed later! (Int i = 1; i & lt; = _x; i ++) // External loop column {for (ii = 1; ii & lt; = _y; ii ++) // Inner loop line is - { Grid.Add (Tupl. (I, ii), "O"); }} Return grid; // should be equal elements of integer I know what to provide in the index to change the value. This is another method.  
  Public zero color pixels (dictionary & lt; tuple & lt; int, int>, string & gt; _table, int _x, int _y, string _c) {foreach (_table) Where var pixel (k => KK.itim1 == _x and KK.itm 2 == _y)) {} // var tbl = _table. // where (t = & gt; TKIT1 == _x and TKITM2 == _y) //. Choose (t = & gt; T.value == _c); }  

Does anyone know how I change the element in the dictionary by accessing the key to the Tuapse?

tuple type is "structurally comparable" means that a To reach the value in a dictionary made by you, you create a new installation of Tupal and see fit (indexer, TryGetValue etc.) in any way.

  var key = Tuple.Create (x, y); Var value = dictionary [key];  

Comments

Popular posts from this blog

java - org.apache.http.ProtocolException: Target host is not specified -

c# - Create dynamic LINQ query expression at runtime which translates into a parameterized SQL query for nullable types -

cmake - cpack generates RPMs with %files entries that conflict with the RPM spec. How to fix? -