Ejemplo n.º 1
0
        public override bool Equals(object obj)
        {
            CodeReference other = obj as CodeReference;

            if (other == null)
            {
                return(false);
            }

            return(this.MetadataName == other.MetadataName);
        }
Ejemplo n.º 2
0
        internal static void AppendParameters(IEnumerable <ParameterName> parameters,
                                              StringBuilder sb)
        {
            bool comma = false;

            foreach (var t in parameters)
            {
                if (comma)
                {
                    sb.Append(',');
                }

                sb.Append(CodeReference.FormatAny(t.ParameterType));
                comma = true;
            }
        }
Ejemplo n.º 3
0
        static Exception _TryParse(string text, out CodeReference result)
        {
            result = null;
            if (text == null)
            {
                return(new ArgumentNullException("text")); // $NON-NLS-1
            }

            text = text.Trim();
            if (text.Length == 0)
            {
                return(Failure.AllWhitespace("name")); // $NON-NLS-1
            }

            int index = text.IndexOf(':');

            if (index < 0)
            {
                result = new UnspecifiedCodeReference(text);
                return(null);
            }

            string specifier = text.Substring(0, index).Trim();
            string name      = text.Substring(index + 1).Trim();

            if (specifier.Length == 1)
            {
                SymbolType type = CodeReferenceHelper.GetReferenceType(specifier[0]);

                if (type != SymbolType.Unknown)
                {
                    result = Create(type, name);
                    return(result.IsValid ? null : Failure.NotParsable("text", typeof(CodeReference)));
                }
            }

            return(Failure.NotParsable("text", typeof(CodeReference)));
        }
Ejemplo n.º 4
0
 public static bool TryParse(string text, out CodeReference result)
 {
     return(_TryParse(text, out result) == null);
 }