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


C# TypeSpec.ToString方法代码示例

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


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

示例1: BeginMethod

 protected void BeginMethod(CodeFormatter cppFile, TypeSpec returnType, string methodName, params object[] parameters)
 {
     cppFile.WriteLine("");
     StringBuilder bld = new StringBuilder();
     bld.AppendFormat("{0} {1}::{2}(", returnType.ToString(), GetClassName(), methodName);
     for (int i = 0; i < parameters.Length; i++)
     {
         MemberSpec ms = parameters[i] as MemberSpec;
         TypeSpec type = ms.Type;
         string name = ms.Name;
         if (name == null || type == null)
         {
             throw new ArgumentException("Wrong arguments to BeginMethod");
         }
         if (i != 0)
             bld.Append(", ");
         if (name == "source" && type.Modifier == TypeSpec.Modifiers.pointer)
             bld.Append("const ");
         bld.AppendFormat("{0} {1}", type.ToString(), name);
     }
     bld.Append(")");
     cppFile.WriteLine(bld.ToString());
     cppFile.WriteLine("{");
 }
开发者ID:killbug2004,项目名称:WSProf,代码行数:24,代码来源:BaseClassMapping.cs

示例2: AdjustTypeForConstSourcePointers

        private string AdjustTypeForConstSourcePointers(TypeSpec ForeignType)
        {
            if (ForeignType.Modifier == TypeSpec.Modifiers.pointer)
            {
                return "const " + ForeignType.ToString();
            }

            return ForeignType.ToString();
        }
开发者ID:killbug2004,项目名称:WSProf,代码行数:9,代码来源:TypeMapping.cs

示例3: ConstructResultWithParams

        private void ConstructResultWithParams(CodeFormatter cppFile, TypeSpec resultType)
        {
            StringBuilder bld = new StringBuilder();
            switch (resultType.Modifier)
            {
                case TypeSpec.Modifiers.value:
                    bld.AppendFormat("{0} result", resultType.ToString());
                    break;
                case TypeSpec.Modifiers.managedReference:
                    if (FCSTypeIsHasContentType)
                    {
                        throw new Exception("case not handled");
                    }
                    else
                    {
                        bld.AppendFormat("{0} result = gcnew {1}", resultType.ToString(), resultType.Name);
                    }
                    break;
                case TypeSpec.Modifiers.pointer:
                    throw new NotImplementedException();
                case TypeSpec.Modifiers.reference:
                    throw new NotImplementedException();
            }

            bld.Append("(");
            foreach (MemberMapping mm in this.MemberMappings)
            {
                bld.AppendFormat("source{0}{1}, ", ForeignType.GetDereferencingOperator(), mm.ForeignSpec.Name);
            }

            bld.Remove(bld.Length - 2, 2);
            bld.Append(");");
            cppFile.WriteLine(bld.ToString());

        }
开发者ID:killbug2004,项目名称:WSProf,代码行数:35,代码来源:TypeMapping.cs

示例4: ConstructResult

 private void ConstructResult(CodeFormatter cppFile, TypeSpec resultType)
 {
     switch (resultType.Modifier)
     {
         case TypeSpec.Modifiers.value:
             cppFile.FormatLine("{0} result(pContext);", resultType.ToString());
             break;
         case TypeSpec.Modifiers.managedReference:
             if (FCSTypeIsHasContentType)
             {
                 cppFile.FormatLine("{0} result = gcnew {1}(true);", resultType.ToString(), resultType.Name);
             }
             else
             {
                 cppFile.FormatLine("{0} result = gcnew {1}();", resultType.ToString(), resultType.Name);
             }
             break;
         case TypeSpec.Modifiers.pointer:
             cppFile.FormatLine("{0} result = new {1}(pContext);", resultType.ToString(), resultType.Name);
             break;
         case TypeSpec.Modifiers.reference:
             throw new NotImplementedException();
     }
 }
开发者ID:killbug2004,项目名称:WSProf,代码行数:24,代码来源:TypeMapping.cs


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