Exemplo n.º 1
0
 private static string AnonymousPropertyInitializerRetriever(IAttributeInstance attr)
 {
     return(attr.PositionParameters()
            .Select(value => value.ConstantValue)
            .Where(value => value.IsString()).SelectNotNull(value => value.Value as string)
            .FirstOrDefault());
 }
Exemplo n.º 2
0
        public IEnumerable <string> GetParameters()
        {
            var parameters = attribute.PositionParameters()
                             .Where(x => !x.IsBadValue)
                             .ToArray();

            var constantItems = parameters.Where(x => x.IsConstant);

            var typeItems = parameters
                            .Where(x => x.IsType)
                            .Select(x => x.TypeValue)
                            .OfType <IDeclaredType>()
                            .Where(x => x.IsValid())
                            .Select(x => x.GetClrName().ShortName);

            var arrayItems = parameters
                             .Where(x => x.IsArray)
                             .SelectMany(x => x.ArrayValue);

            var stringItems = constantItems
                              .Concat(arrayItems)
                              .Select(x => x.ConstantValue.Value)
                              .Where(x => x != null)
                              .Select(x => x !.ToString());

            return(typeItems.Concat(stringItems));
        }
Exemplo n.º 3
0
        public CommonAttribute GetCommonAttribute(IAttributeInstance attributeInstance)
        {
            var type = GetCommonType(attributeInstance.GetAttributeType());
            var positionalArguments = attributeInstance.PositionParameters().Select(GetPositionalArgument).WhereNotNull();
            var namedArguments      = attributeInstance.NamedParameters().Select(GetNamedArguments).WhereNotNull();

            return(new CommonAttribute(type, positionalArguments, namedArguments));
        }
Exemplo n.º 4
0
        public CommonAttribute GetCommonAttribute(IAttributeInstance attributeInstance)
        {
            var type = GetCommonType(attributeInstance.GetAttributeType());
              var positionalArguments = attributeInstance.PositionParameters().Select(GetPositionalArgument).WhereNotNull();
              var namedArguments = attributeInstance.NamedParameters().Select(GetNamedArguments).WhereNotNull();

              return new CommonAttribute(type, positionalArguments, namedArguments);
        }