Ejemplo n.º 1
0
        internal static void AppendMethod(Method method, StringBuilder sb, bool includeParameters = true) {
            if (String.IsNullOrEmpty(method?.Name)) {
                sb.Append("<null>");
                return;
            }

            if (!String.IsNullOrEmpty(method.DeclaringNamespace))
                sb.Append(method.DeclaringNamespace).Append(".");

            if (!String.IsNullOrEmpty(method.DeclaringType))
                sb.Append(method.DeclaringType.Replace('+', '.')).Append(".");

            sb.Append(method.Name);

            if (method.GenericArguments?.Count > 0) {
                sb.Append("[");
                bool first = true;
                foreach (string arg in method.GenericArguments) {
                    if (first)
                        first = false;
                    else
                        sb.Append(",");

                    sb.Append(arg);
                }

                sb.Append("]");
            }

            if (includeParameters) {
                sb.Append("(");
                bool first = true;
                if (method.Parameters?.Count > 0) {
                    foreach (Parameter p in method.Parameters) {
                        if (first)
                            first = false;
                        else
                            sb.Append(", ");

                        if (String.IsNullOrEmpty(p.Type))
                            sb.Append("<UnknownType>");
                        else
                            sb.Append(p.Type.Replace('+', '.'));

                        sb.Append(" ");
                        sb.Append(p.Name);
                    }
                }
                sb.Append(")");
            }
        }
Ejemplo n.º 2
0
 protected bool Equals(Method other)
 {
     return(IsSignatureTarget == other.IsSignatureTarget && String.Equals(DeclaringNamespace, other.DeclaringNamespace) && String.Equals(DeclaringType, other.DeclaringType) && String.Equals(Name, other.Name) && Equals(Data, other.Data) && GenericArguments.CollectionEquals(other.GenericArguments) && Parameters.CollectionEquals(other.Parameters));
 }
Ejemplo n.º 3
0
        private string GetStackFrameSignature(Method method) {
            var builder = new StringBuilder(255);

            if (method == null)
                return builder.ToString();

            builder.Append(method.GetSignature());

            return builder.ToString();
        }
Ejemplo n.º 4
0
 protected bool Equals(Method other)
 {
     return IsSignatureTarget == other.IsSignatureTarget && string.Equals(DeclaringNamespace, other.DeclaringNamespace) && string.Equals(DeclaringType, other.DeclaringType) && string.Equals(Name, other.Name) && Equals(Data, other.Data) && GenericArguments.CollectionEquals(other.GenericArguments) && Parameters.CollectionEquals(other.Parameters);
 }