私はこのクラスを持っています:
public class SmartTable : DataTable
{
public string this[int Row, int Column] { ... }
public string this[int Row, string Column] { ... }
}
THIS[,] に暗黙の演算子を追加したい
それから私は使用できます:
string s = smartT[a,b];
また
int i = smartT[a,b];
これをグーグルで検索しましたが、検索方法がわかりません。
私は(IntelliSenseに基づいて)次のような宣言を試みました:
public static implicit operator int[int r, int c](...) {...}
また
public static implicit operator int (SmartTable sm, int a, int b)
動作しません。
ありがとう
=== 編集 ===
これは DataTable で、テーブルには文字列、整数などがあります。
このテーブルを使用するたびに put Convert.To--(...) を避けたい...
フィールドを int に配置しようとすると、それは整数フィールドだからです...私が使用している解決策は create iGet(int C, int R), sGet(...), dGet(...) です