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


C# DataRow.StringOrDefault方法代码示例

本文整理汇总了C#中System.Data.DataRow.StringOrDefault方法的典型用法代码示例。如果您正苦于以下问题:C# DataRow.StringOrDefault方法的具体用法?C# DataRow.StringOrDefault怎么用?C# DataRow.StringOrDefault使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Data.DataRow的用法示例。


在下文中一共展示了DataRow.StringOrDefault方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: _initfromRow

 private void _initfromRow(DataRow dr)
 {
     FrameId = dr.IntOrZero("FrameId");
     PanelId = dr.IntOrZero("PanelId");
     Duration = dr.IntOrDefault("Duration", 60);
     Sort = dr.IntOrZero("Sort");
     BeginsOn = dr["BeginsOn"] == DBNull.Value ? null : (DateTime?)dr["BeginsOn"];
     EndsOn = dr["EndsOn"] == DBNull.Value ? null : (DateTime?)dr["EndsOn"];
     DateCreated = dr["DateCreated"] == DBNull.Value ? null : (DateTime?)dr["DateCreated"];
     TemplateName = dr.StringOrDefault("TemplateName", "default");
     Html = dr.StringOrBlank("Html");
     FrameType = (FrameTypes)dr.IntOrZero("FrameType");
     CacheInterval = dr.IntOrZero("CacheInterval");
     CacheInterval = CacheInterval < 0 ? 0 : CacheInterval;
     Version = BitConverter.ToUInt64((byte[])dr["Version"], 0);       // is never a null
 }
开发者ID:Fivebread,项目名称:DisplayMonkey,代码行数:16,代码来源:Frame.cs

示例2: _initFromRow

        private void _initFromRow(DataRow r)
		{
            this.LocationId = r.IntOrZero("LocationId");
            this.LevelId = r.IntOrZero("LevelId");
            this.TemperatureUnit = r.StringOrDefault("TemperatureUnit", "C").ToLower();
            this.DateFormat = r.StringOrDefault("DateFormat", "LL");
            this.TimeFormat = r.StringOrDefault("TimeFormat", "LT");
            this.Name = r.StringOrBlank("Name");
            if (this.Name == "")
                this.Name = string.Format("Location {0}", this.LocationId);

            this.TimeZone = TimeZoneInfo.FindSystemTimeZoneById(
                r.StringOrDefault("TimeZone", ServerGeoData.TimeZone.Id)
                );

            double? latitude = r["Latitude"] as Nullable<double>;
            if (latitude != null)
                this.Latitude = latitude.Value;
            else
                this.Latitude = ServerGeoData.Latitude;

            double? longitude = r["Longitude"] as Nullable<double>;
            if (longitude != null)
                this.Longitude = longitude.Value;
            else
                this.Longitude = ServerGeoData.Longitude;

            int? woeid = r["Woeid"] as Nullable<int>;
            this.Woeid = woeid ?? 0;

            this.Culture = r.StringOrBlank("Culture");
        }
开发者ID:Fivebread,项目名称:DisplayMonkey,代码行数:32,代码来源:Location.cs


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