当前位置: 首页>>代码示例>>C#>>正文


C# Data.ContainsKey方法代码示例

本文整理汇总了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;
        }
开发者ID:sundowndk,项目名称:sXUL,代码行数:29,代码来源:Event.cs

示例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;
        }
开发者ID:sundowndk,项目名称:sXUL,代码行数:42,代码来源:Config.cs

示例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;
        }
开发者ID:sundowndk,项目名称:sXUL,代码行数:17,代码来源:EventListener.cs


注:本文中的Data.ContainsKey方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。