Friday, 15 July 2011

c# - How can I store and lookup a Delegate Method in a dictionary based on Type? -


I have an application with multiple DataGridViews . I want to run a similar event on all of them, to check that when the user changes the data on a cell edit or selects a different cell. To do this, I've added a method for CellEndEdit and Selviliting Events .

I have taken it out of the code where my change check management signature looks like this:

  process change check & lt; Typed bell & lt; Detachera & gt ;, Detroit & gt; (DGV, Valid Aventar, Columns Index, Validating the Event Series, ROINDEX, OTRINAL);   

getOriginal Func & lt; Decimal, typed tablebase & lt; DataRow & gt; & Gt;

The idea that I only have one event to add to each table I and DataGridView data to be displayed Based on the type of getOriginal method is for viewing.

I have tried the following dictionary approach:

  // Private dictionary  

Although casting leads to errors.

Note:
Each of these methods is a different type of approximately NamedDataTable: typed database

The problem I can tell is stem from the nested type on TypedTableBase .

I've described with a dictionary implementation that look like this in my event Hanndlrs are:

  private void Chekifsnkrt (object sender, Detagrid Drishykelaventargs e) {DataGridView dgv = (DataGridView) sender; Detourview DRV = (Detourviewview) DGV RO [0] .Database accountant; Func & lt; Decimal, typed tabile base & lt; DataRow & gt; & Gt; GetOriginal = LookupGetronic (Dr. W. Gaittype ()); Process ISZ probe & lt; Typed table & lt; Datarao>, Detroit & gt; (DGV, E. column index, E.RO index, gororin); Fresh (); }  

So how can I properly defined your dictionary say, it will compile and I looking Gorordinl method based on the data type of data Grarid data and dynamically passes Am I


No comments:

Post a Comment