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


C# FieldType.ToString方法代码示例

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


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

示例1: CAMLQueryGenericFilter

 /// <summary>
 /// Initializes a new instance of the <see cref="CAMLQueryGenericFilter"/> class.
 /// </summary>
 /// <param name="fieldName">Name of the field.</param>
 /// <param name="fieldType">Type of the field.</param>
 /// <param name="fieldValue">The field value.</param>
 /// <param name="queryType">Type of the query.</param>
 public CAMLQueryGenericFilter(string fieldName, FieldType fieldType, string fieldValue, QueryType queryType)
 {
     try
     {
         this.FieldName = fieldName;
         this.FieldType = fieldType;
         this.FieldValue = fieldValue;
         string filterMarkUp = string.Empty;
         filterMarkUp = string.Format(this.GetQueryTypeMarkUp(queryType), CAMLQueryFilter.QueryFIELDREFMarkUp, CAMLQueryFilter.QueryVALUEMarkUp);
         this.Query = string.Format(filterMarkUp, fieldName, fieldType.ToString(), fieldValue);
     }
     catch (Exception ex)
     {
         throw ex;
     }
 }
开发者ID:noormahdi,项目名称:CAML-Query-Builder,代码行数:23,代码来源:CAMLQueryGenericFilter.cs

示例2: CreateFieldString

        /// <summary>
        ///     获取字段创建字符串
        /// </summary>
        /// <param name="fieldName">字段名称</param>
        /// <param name="isPrimaryKey">是否为主键</param>
        /// <param name="isIdentity">是否自增长</param>
        /// <param name="isNotNull">是否不为空</param>
        /// <param name="fieldType">字段类型</param>
        /// <param name="fieldLength">字段长度</param>
        /// <param name="fieldDefaultValue">字段默认值</param>
        protected override string CreateFieldString(string fieldName, bool isPrimaryKey, bool isIdentity, bool isNotNull,
                                                    FieldType fieldType, int? fieldLength, object fieldDefaultValue)
        {
            if (fieldDefaultValue is Enum)
            {
                fieldDefaultValue = (int) fieldDefaultValue;
            }
            if (fieldDefaultValue != null)
            {
                if (
                    !fieldDefaultValue.ToString().StartsWith("'") &&
                    (fieldType == FieldType.Char ||
                     fieldType == FieldType.NChar ||
                     fieldType == FieldType.Ntext ||
                     fieldType == FieldType.Nvarchar ||
                     fieldType == FieldType.Text ||
                     fieldType == FieldType.Varchar))
                {
                    fieldDefaultValue = "'" + fieldDefaultValue + "'";
                }
            }
            var sql = new StringBuilder();

            sql.AppendFormat("{0} ", dbProvider.CreateTableAegis(fieldName));
            sql.AppendFormat("{0} ", fieldType.ToString());
            if (fieldLength != null)
            {
                sql.AppendFormat("({0}) ", fieldLength);
            }
            if (isIdentity)
            {
                sql.Append("AUTO_INCREMENT ");
            }
            sql.Append(isNotNull ? "NOT NULL " : "NULL ");
            if (isPrimaryKey)
            {
                sql.Append("PRIMARY KEY ");
            }
            if (fieldDefaultValue != null && fieldDefaultValue.ToString().Length > 0)
            {
                sql.AppendFormat("DEFAULT {0} ", fieldDefaultValue);
            }
            ;

            return sql.ToString();
        }
开发者ID:lirongjun0926,项目名称:Farseer.Net,代码行数:56,代码来源:MySqlOperate.cs

示例3: warn_add_OBJ_field_mismatch_with_archetype_field

 void warn_add_OBJ_field_mismatch_with_archetype_field(Obj obj, string field_name, FieldType obj_field_type)
 {
     warn_at();
     Form1.stdout.print("         Field type mismatch with Archetype '{1}', ignoring OBJ field '{0}',\n" +
                        "         obj_field_type '{2}' != arch_field_type '{3}'\n",
                         field_name, obj.archetype.tag, obj_field_type.ToString(), obj.archetype[field_name].type.ToString());
 }
开发者ID:sglasby,项目名称:HRAOS,代码行数:7,代码来源:Script_Parser.cs

示例4: FormatFieldType

 private static string FormatFieldType(FieldType fieldType)
 {
     if (fieldType == FieldType.Short || fieldType == FieldType.Byte)
     {
         return string.Format("({0})", fieldType.ToString().ToLower());
     }
     return "";
 }
开发者ID:lvshiling,项目名称:Scut,代码行数:8,代码来源:TemplateHelper.cs

示例5: CreateField

 /// <summary>
 /// Create field to web remotely
 /// </summary>
 /// <param name="web">Site to be processed - can be root web or sub site</param>
 /// <param name="id">Guid for the new field.</param>
 /// <param name="internalName">Internal name of the field</param>
 /// <param name="fieldType">Field type to be created.</param>
 /// <param name="displayName">The display name of the field</param>
 /// <param name="group">The field group name</param>
 /// <returns>The newly created field or existing field.</returns>
 public static Field CreateField(this Web web, Guid id, string internalName, FieldType fieldType, string displayName, string group, string additionalXmlAttributes = "", bool executeQuery = true)
 {
     return CreateField(web, id, internalName, fieldType.ToString(), displayName, group, additionalXmlAttributes, executeQuery);
 }
开发者ID:usmanfast,项目名称:PnP,代码行数:14,代码来源:FieldAndContentTypeExtensions.cs

示例6: warn_add_OBJ_field_defaulting_to_basic_field_type

 void warn_add_OBJ_field_defaulting_to_basic_field_type(string field_name, string arch_tag, FieldType type)
 {
     warn_at();
     Form1.stdout.print("         Archetype '{1}' does not define OBJ field '{0}', defaulting type to '{2}'\n",
                        field_name, arch_tag, type.ToString());
 }
开发者ID:sglasby,项目名称:HRAOS,代码行数:6,代码来源:Script_Parser.cs

示例7: FormatField

        static string FormatField(Guid fieldId, string internalName, FieldType fieldType, string displayName, string description, string groupName, string attributes)
        {
            if (attributes == null)
                attributes = string.Empty;

            description = description.Replace("<", "&lt;").Replace(">", "&gt;").Replace("\"", "&quot;");
            attributes += string.Format(" Description=\"{0}\"", description);
            return FormatFieldXml(fieldId, internalName, fieldType.ToString(), displayName, groupName, attributes);
        }
开发者ID:Calisto1980,项目名称:PnP,代码行数:9,代码来源:SiteRequestList.cs

示例8: TranslateOgrType

        private Type TranslateOgrType(FieldType ogrType)
        {
            switch (ogrType)
            {
                case FieldType.OFTInteger:
                    return typeof(Int32);

                case FieldType.OFTReal:
                    return typeof(Double);

                case FieldType.OFTWideString:
                case FieldType.OFTString:
                    return typeof(String);

                case FieldType.OFTBinary:
                    return typeof(Byte[]);

                case FieldType.OFTDate:
                case FieldType.OFTTime:
                case FieldType.OFTDateTime:
                    return typeof(DateTime);

                case FieldType.OFTIntegerList:
                case FieldType.OFTRealList:
                case FieldType.OFTStringList:
                case FieldType.OFTWideStringList:
                    throw new NotSupportedException("Type not supported: " + ogrType.ToString());

                default:
                    throw new NotSupportedException("Type not supported: " + ogrType.ToString());
            }
        }
开发者ID:ExRam,项目名称:DotSpatial-PCL,代码行数:32,代码来源:OgrDataReader.cs

示例9: FieldCreationInformation

 public FieldCreationInformation(FieldType fieldType)
 {
     this.FieldType = fieldType.ToString();
 }
开发者ID:AaronSaikovski,项目名称:PnP,代码行数:4,代码来源:FieldCreationInformation.cs

示例10: LoadNodeField

        /// <summary>
        /// Loads a node field.
        /// <param name="fieldType">The target field type enum.</param>
        /// <param name="type">The real target field type.</param>
        /// <param name="fieldPath">The field path.</param>
        /// </summary>
        object LoadNodeField (FieldType fieldType, System.Type type, string fieldPath) {
            var fieldIndex = m_FieldIndex[m_NextFieldIndex];
            // value types
            switch (fieldType) {
                // It's a none var?
                case FieldType.None:
                    // Get generic type
                    var genericType = TypeUtility.GetType(m_StringValue[fieldIndex]);
                    
                    if (genericType == null) {
                        // Try to get the field type
                        if (type != null)
                            genericType = type.IsAbstract ? TypeUtility.GetConcreteType(type) : type;
                    }
                    else if (genericType.IsAbstract) {
                        // Try to get the concrete type
                        genericType = TypeUtility.GetConcreteType(genericType) ?? TypeUtility.GetConcreteType(type);
                    }
                    else if (genericType.IsInterface) {
                        Print.LogError("Can't serialize abstract or interface fields: " + genericType.ToString());
                        return null;
                    }

                    // Create the generic object
                    if (typeof(GameObjectVar).IsAssignableFrom(genericType))
                        return Activator.CreateInstance(genericType, new object[] {m_GameObject});
                    else
                        return Activator.CreateInstance(genericType);
                // It's a constant var?
                case FieldType.Constant:
                    // Get generic type
                    genericType = TypeUtility.GetType(m_GenericFieldType[fieldIndex]);

                    if (genericType == null) {
                        // Try to get the field type
                        if (type != null)
                            genericType = type.IsAbstract ? TypeUtility.GetConcreteType(type) : type;
                    }
                    else if (genericType.IsAbstract) {
                        // Try to get the concrete type
                        genericType = TypeUtility.GetConcreteType(genericType) ?? TypeUtility.GetConcreteType(type);
                    }
                    else if (genericType.IsInterface) {
                        Print.LogError("Can't serialize interface fields: " + genericType.ToString());
                        return null;
                    }

                    // Create the generic object
                    var variable = Activator.CreateInstance(genericType) as BehaviourMachine.Variable;

                    if (variable == null)
                        return null;

                    // The type has changed?
                    if (m_GenericFieldHash[fieldIndex] != TypeToHash(genericType)) {
                        var fieldSize = m_GenericFieldSize[fieldIndex];
                        m_NextFieldIndex++;
                        TryLoadFields(variable, fieldSize, fieldPath);
                    }
                    else {
                        m_NextFieldIndex++;
                        LoadFields(variable, fieldPath);
                    }

                    variable.SetAsConstant();
                    m_NextFieldIndex--;

                    return variable;
                // FloatVar
                case FieldType.FloatVar:
                    // Get variable id
                    var varId = m_IntValue[fieldIndex];
                    // Get variable
                    if (varId > 0)
                        return m_Blackboard.GetFloatVar(varId);
                    else if (InternalGlobalBlackboard.Instance != null)
                        return InternalGlobalBlackboard.Instance.GetFloatVar(varId);
                    else
                        return new ConcreteFloatVar();
                // IntVar
                case FieldType.IntVar:
                    // Get variable id
                    varId = m_IntValue[fieldIndex];
                    // Get variable
                    if (varId > 0)
                        return m_Blackboard.GetIntVar(varId);
                    else if (InternalGlobalBlackboard.Instance != null)
                        return InternalGlobalBlackboard.Instance.GetIntVar(varId);
                    else
                        return new ConcreteIntVar();
                // BoolVar
                case FieldType.BoolVar:
                    // Get variable id
                    varId = m_IntValue[fieldIndex];
//.........这里部分代码省略.........
开发者ID:xclouder,项目名称:godbattle,代码行数:101,代码来源:NodeSerialization.cs

示例11: _TestRunner

        /// <summary>
        ///   Executes the provided <see cref="Action"/> several times to average out the time spent in execution.
        /// </summary>
        /// <param name="action">The action representing the test.</param>
        /// <param name="fieldType">The field type to test (Delimited or FixedWidth).</param>
        /// <param name="lngFileLength">The length of the file being parsed in bytes.</param>
        /// <param name="strTestName">The name of the test.</param>
        private static void _TestRunner(Action action, FieldType fieldType, long lngFileLength, string strTestName)
        {
            Stopwatch sw;
            double dblAvgDuration;

            // Clear out the trash so as to minimize the likelyhood of the garbage being taken out during the tests.
            GC.Collect();
            GC.WaitForFullGCComplete();
            GC.WaitForPendingFinalizers();

            sw = Stopwatch.StartNew();

            for (int intTestIteration = 0; intTestIteration < PerformanceTests.ITERATIONS_OF_TESTS; ++intTestIteration)
            {
                action();
            }

            sw.Stop();

            dblAvgDuration = ((double)sw.ElapsedMilliseconds) / ((double)PerformanceTests.ITERATIONS_OF_TESTS);

            Console.WriteLine(string.Format("{0,-10} {1,21} - Avg. Time {2,10:#0.0} (ms) [{3,14}]",
                fieldType.ToString(),
                strTestName,
                dblAvgDuration,
                PerformanceTests._CalculateThroughput(lngFileLength, dblAvgDuration)));
        }
开发者ID:chouzicz,项目名称:SQLForExcel,代码行数:34,代码来源:PerformanceTests.cs


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