⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 datarow.cs

📁 微软的行业应用解决方案示例
💻 CS
字号:
using System;
using System.Linq;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using System.Text;

namespace Microsoft.Mobile.Data
{
    /// <summary>
    /// Object that represents a row of columns. The columns can be retrieved 
    /// by name.
    /// </summary>
    [SuppressMessage("Microsoft.Naming",
                     "CA1710:IdentifiersShouldHaveCorrectSuffix",
                     Justification = "More readable as DataRow")]
    public class DataRow : Dictionary<string, object>
    {
        #region Methods
        /// <summary>
        /// This method allows for safe setting of a byte array from the 
        /// database. The value could be null.
        /// </summary>
        /// <typeparam name="T">type to be converted</typeparam>
        /// <param name="newValue">new value</param>
        /// <returns>a type or null</returns>
        [SuppressMessage("Microsoft.Design",
                         "CA1004:GenericMethodsShouldProvideTypeParameter",
                         Justification = "This is deliberate as the method ensures that the object is of the generic type.")]
        public static T SetValue<T>(object newValue)
        {
            T result = default(T);

            // Check to see if value is null or not
            if ((newValue != null) && (newValue != DBNull.Value))
            {
                result = (T)newValue;
            }

            return result;
        }
        #endregion
    }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -