Ejemplo n.º 1
0
        public MetadataNameFormat(MetadataNameFormat options)
        {
            if (options == null)
            {
                options = MetadataNameFormat.Default;
            }

            DefaultFormatString.CopyBuffer(options.DefaultFormatString);
            _includeAttributes      = options.IncludeAttributes.Clone();
            _includeModifiers       = options.IncludeModifiers.Clone();
            _includeReturnTypes     = options.IncludeReturnTypes.Clone();
            _includeTypeConstraints = options.IncludeTypeConstraints;
            _includeTypeParameters  = options.IncludeTypeParameters;
            _includeVariance        = options.IncludeVariance;
        }
Ejemplo n.º 2
0
        static Exception _TryParse(string text, out SymbolTypes result)
        {
            result = null;

            if (text == null)
            {
                return(new ArgumentNullException(nameof(text)));
            }

            text = text.Trim();
            if (text.Length == 0)
            {
                return(Failure.AllWhitespace(nameof(text)));
            }
            if (text == "All")
            {
                result = new SymbolTypes(true);
                return(null);
            }
            if (text == "None")
            {
                result = new SymbolTypes();
                return(null);
            }

            result = new SymbolTypes();

            foreach (var t in Utility.SplitTokens(text))
            {
                SymbolType symbol;

                if (Enum.TryParse(t, true, out symbol))
                {
                    result[symbol] = true;
                }
                else
                {
                    return(Failure.NotParsable(nameof(text), typeof(SymbolTypes)));
                }
            }

            return(null);
        }
Ejemplo n.º 3
0
 public static bool TryParse(string text, out SymbolTypes result)
 {
     return(_TryParse(text, out result) == null);
 }