本文整理汇总了C#中Data.ContainsKey方法的典型用法代码示例。如果您正苦于以下问题:C# Data.ContainsKey方法的具体用法?C# Data.ContainsKey怎么用?C# Data.ContainsKey使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Data
的用法示例。
在下文中一共展示了Data.ContainsKey方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: FromData
public static Event FromData(Data data)
{
Event result = new Event ();
if (data.ContainsKey ("id"))
result._id = data.Get<Guid>("id");
else
throw new Exception (string.Format (SorentoLib.Strings.Exception.JSONFrom, typeof (Event), "ID"));
if (data.ContainsKey ("createtimestamp"))
result._createtimestamp = data.Get<int>("createtimestamp");
if (data.ContainsKey ("updatetimestamp"))
result._updatetimestamp = data.Get<int>("updatetimestamp");
if (data.ContainsKey ("sort"))
result._sort = data.Get<double>("sort");
if (data.ContainsKey ("name"))
result._name = data.Get<string>("name");
if (data.ContainsKey ("ownerid"))
result._ownerid = data.Get<Guid>("ownerid");
if (data.ContainsKey ("data"))
result._data = data.Get<Data>("data");
return result;
}
示例2: FromData
/// <summary>
/// Convert from <see cref="SorentoLib.Data"/> string to <see cref="SorentoLib.User"/>.
/// </summary>
private static User FromData(Data Data, bool Internal)
{
User result = new User ();
if (Data.ContainsKey ("id"))
result._id = Data.Get<Guid>("id");
else
throw new Exception (string.Format (Strings.Exception.JSONFrom, typeof (User), "ID"));
if (Data.ContainsKey ("createtimestamp"))
result._createtimestamp = Data.Get<int> ("createtimestamp");
if (Data.ContainsKey ("updatetimestamp"))
result._updatetimestamp = Data.Get<int> ("updatetimestamp");
if (Data.ContainsKey ("usergroupids"))
foreach (Guid id in Data.Get<List<Guid>>("usergroupids"))
result._usergroupids.Add (id);
if (Data.ContainsKey ("username"))
result._username = Data.Get<string>("username");
if (Data.ContainsKey ("email"))
result._email = Data.Get<string>("email");
if (Data.ContainsKey ("realname"))
result._realname = Data.Get<string>("realname");
if (Internal)
if (Data.ContainsKey ("password"))
result._password = Data.Get<string>("password");
else
result._password = User.Load (result._id)._password;
if (Data.ContainsKey ("status"))
result._status = Data.Get<Enums.UserStatus> ("status");
return result;
}
示例3: FromData
public static EventListener FromData(Data data)
{
EventListener result = new EventListener ();
if (data.ContainsKey ("id"))
result._id = data.Get<Guid>("id");
else
throw new Exception (string.Format (SorentoLib.Strings.Exception.JSONFrom, typeof (Event), "ID"));
if (data.ContainsKey ("createtimestamp"))
result._createtimestamp = data.Get<int>("createtimestamp");
if (data.ContainsKey ("updatetimestamp"))
result._updatetimestamp = data.Get<int>("updatetimestamp");
return result;
}