次のような値を操作するためのさまざまなプロパティを持つデータベースで使用する独自のデータ型があります。
First: original value
IsNull: is the current state null (no value in Data)
IsFirstNull: was the initial state of the object null
Changed: has the value changed since the initial value was set.
SetNull(): set the object to null
SetFirstNull: set the initial value to null
Reset: set values all to original settings.
各オブジェクトにはこれらがあります。次のような標準変数のタイプごとにオブジェクトがあります。
int - IntType
string - StringType
bool - BoolType
使用している各テーブルのクラスにこれらの変数があります。
これらにアクセスできるようにしたいので、これらを辞書に追加することを検討しています。ただし、各項目は異なる型 (IntType、StringType、BoolType など) になります。
だから私はこれらを asDictionary<string, object>
または as として設定しましたDictionary<string, dynamic>
。
どちらが最適かわからない - どちらが優れているか?
public class LoginDC
{
private IntType loginID = new IntType();
private StringType userName = new StringType();
public LoginDC()
{
Dictionary<string, dynamic> propertyList = new Dictionary<string, dynamic>();
propertyList.Add("LoginID", loginID);
propertyList.Add("UserName", userName);
propertyList["UserName"].First = "Tom"
}
}
だから私の他の質問は:
propertyList には、.Add の後に loginID と userName への参照が含まれていますか? したがって、propertyList または変数のいずれかを変更すると、両方に同じ値が含まれます。または、propertyList には 2 つの変数の値のコピーが含まれていますか?
参考になりそうですが未確認です。