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


C# ConstructorInfo.ToString方法代码示例

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


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

示例1: EmitNewObject

        public void EmitNewObject(ConstructorInfo ci)
        {
            ProcessCommand(
                OpCodes.Newobj,
                ci.GetParameters().Length * -1 + 1,
                ci.ToString()
                );

            ilGenerator.Emit(OpCodes.Newobj, ci);
        }
开发者ID:antonovicha,项目名称:EmitMapperRedux,代码行数:10,代码来源:CompilationContext.cs

示例2: GetCommentLines

    public IEnumerable<string> GetCommentLines(ConstructorInfo constructor)
    {
      string memberName = "M:" + constructor.DeclaringType.FullName + ".#" + constructor.ToString().Substring(6);
      memberName = memberName.Replace("()", "");
      memberName = memberName.Replace(", ", ",");
      memberName = memberName.Replace("Boolean", "System.Boolean");
      memberName = memberName.Replace("Double", "System.Double");
      memberName = memberName.Replace("Int32", "System.Int32");
      if (memberName.Contains("IEnumerable"))
      {
        memberName = memberName.Replace("`1[", "{");
        memberName = memberName.Replace("])", "})");
      }

      var comment = _Comments.XPathSelectElement("/doc/members/member[@name='" + memberName + "']");
      if (comment == null)
        throw new NotImplementedException(memberName);

      foreach (var node in comment.Nodes())
      {
        foreach (string line in node.ToString().Split('\n'))
          yield return "/// " + line.Trim();
      }
    }
开发者ID:dlemstra,项目名称:Magick.NET,代码行数:24,代码来源:DrawableTypes.cs

示例3: New

 internal void New(ConstructorInfo constructorInfo)
 {
     if (_codeGenTrace != CodeGenTrace.None)
         EmitSourceInstruction("Newobj " + constructorInfo.ToString() + " on type " + constructorInfo.DeclaringType.ToString());
     _ilGen.Emit(OpCodes.Newobj, constructorInfo);
 }
开发者ID:ChuangYang,项目名称:corefx,代码行数:6,代码来源:CodeGenerator.cs

示例4: Call

 internal void Call(ConstructorInfo ctor)
 {
     if (_codeGenTrace != CodeGenTrace.None)
         EmitSourceInstruction("Call " + ctor.ToString() + " on type " + ctor.DeclaringType.ToString());
     _ilGen.Emit(OpCodes.Call, ctor);
 }
开发者ID:ChuangYang,项目名称:corefx,代码行数:6,代码来源:CodeGenerator.cs

示例5: OkToUse

 public bool OkToUse(ConstructorInfo c, out string message)
 {
     if (c == null) throw new ArgumentNullException("c");
     string toCheckStr = c.DeclaringType.ToString() + "." + c.ToString(); //[email protected]
     return OkToUseInternal(toCheckStr, this.require_members, this.forbid_members, out message); //[email protected]
     //return OkToUseInternal(c.ToString(), this.require_members, this.forbid_members, out message); //[email protected]
 }
开发者ID:SJMakin,项目名称:Randoop.NET,代码行数:7,代码来源:ReflectionFilters.cs

示例6: Match

        protected virtual bool Match(ConstructorInfo ctor, Type type)
        {
            switch (type.Name) {
            case "MKTileOverlayRenderer":
                // NSInvalidArgumentEception Expected a MKTileOverlay
                // looks like Apple has not yet added a DI for this type, but it should be `initWithTileOverlay:`
                if (ctor.ToString () == "Void .ctor(IMKOverlay)")
                    return true;
                break;
            case "MPSImageHistogram":
                // Could not initialize an instance of the type 'MetalPerformanceShaders.MPSImageHistogram': the native 'initWithDevice:' method returned nil.
                // make sense: there's a `initWithDevice:histogramInfo:` DI
                if (ctor.ToString () == "Void .ctor(IMTLDevice)")
                    return true;
                break;
            case "NSDataDetector":
                // -[NSDataDetector initWithPattern:options:error:]: Not valid for NSDataDetector
                if (ctor.ToString () == "Void .ctor(NSString, NSRegularExpressionOptions, NSError&)")
                    return true;
                break;
            #if __TVOS__
            case "UISearchBar":
                // - (nullable instancetype)initWithCoder:(NSCoder *)aDecoder NS_DESIGNATED_INITIALIZER __TVOS_PROHIBITED;
                return true;
            #endif
            }

            var expected = ctor.ToString ();
            // NonPublic to get `protected` which can be autogenerated for abstract types (subclassing a non-abstract type)
            foreach (var candidate in type.GetConstructors (BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.Instance)) {
                if (candidate.ToString () == expected)
                    return true;
            }
            return false;
        }
开发者ID:yudhitech,项目名称:xamarin-macios,代码行数:35,代码来源:ApiCtorInitTest.cs

示例7: New

 internal void New(ConstructorInfo constructor)
 {
     if (this.codeGenTrace != CodeGenTrace.None)
     {
         this.EmitSourceInstruction("Newobj " + constructor.ToString() + " on type " + constructor.DeclaringType.ToString());
     }
     this.ilGen.Emit(OpCodes.Newobj, constructor);
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:8,代码来源:CodeGenerator.cs

示例8: ProcessConstructor

 void ProcessConstructor(ConstructorInfo constructorInfo)
 {
     Debug.WriteLine ("Add constructor " + constructorInfo.ToString ());
 }
开发者ID:NotJRM,项目名称:jrm-code-project,代码行数:4,代码来源:LScript.cs

示例9: OkToUse

 public bool OkToUse(ConstructorInfo c, out string message)
 {
     if (c == null) throw new ArgumentNullException("c");
     return OkToUseInternal(c.ToString(), this.require_members, this.forbid_members, out message);
 }
开发者ID:SJMakin,项目名称:Randoop.NET,代码行数:5,代码来源:ReflectionFilters.cs

示例10: Emit

 public void Emit(OpCode opCode, ConstructorInfo ci)
 {
     ProcessCommand(opCode, 0, ci.ToString());
     ilGenerator.Emit(opCode, ci);
 }
开发者ID:antonovicha,项目名称:EmitMapperRedux,代码行数:5,代码来源:CompilationContext.cs

示例11: OkToUse

        /// <summary>
        /// Determines of the target constructor is ok to use.
        /// </summary>
        /// <param name="constructor">
        /// The constructor to test
        /// </param>
        /// <param name="message">
        /// A message for the caller.
        /// </param>
        /// <returns>
        /// True if the constructor is ok to use, false otherwise.
        /// </returns>
        public bool OkToUse(ConstructorInfo constructor, out string message)
        {
            if (constructor != null)
            {
                foreach (ForbidExpression fExp in this.forbiddenMembers)
                {
                    if (fExp.IsForbidden(constructor.ToString()))
                    {
                        message = string.Format("The Constructor {0} matches the ForbidExpression with pattern {1}. It will not be used.", constructor.ToString(), fExp.Pattern);
                        return false;
                    }
                }

                message = string.Format("The Constructor {0} will be used.", constructor.ToString());
                return true;
            }
            else
            {
                message = "The passed in Constructor argument was null";
                throw new ArgumentNullException(message);
            }
        }
开发者ID:jduv,项目名称:WinBert,代码行数:34,代码来源:PermissiveReflectionFilter.cs


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