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;
        }
Example #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);
        }
Example #3
0
 public static bool TryParse(string text, out SymbolTypes result)
 {
     return(_TryParse(text, out result) == null);
 }