示例#1
0
        public override Json.Expression ToJson(SerializationDomain domain)
        {
            var declType = DeclaringType.ToJson();

            if (!domain.IsV08)
            {
                var indexParameterTypes = _property.IndexParameterTypes;
                var indexParameterCount = indexParameterTypes.Count;

                var indexParameterList = new Json.Expression[indexParameterCount];

                for (var i = 0; i < indexParameterCount; i++)
                {
                    indexParameterList[i] = domain.AddType(indexParameterTypes[i]).ToJson();
                }

                var indexParameters = Json.Expression.Array(indexParameterList);

                if (_property.PropertyType != null)
                {
                    var propType = domain.AddType(_property.PropertyType).ToJson();

                    return(Json.Expression.Array(
                               Discriminators.MemberInfo.PropertyDiscriminator,
                               declType,
                               Json.Expression.String(_property.Name),
                               indexParameters,
                               propType
                               ));
                }
                else
                {
                    return(Json.Expression.Array(
                               Discriminators.MemberInfo.PropertyDiscriminator,
                               declType,
                               Json.Expression.String(_property.Name),
                               indexParameters
                               ));
                }
            }
            else
            {
                return(Json.Expression.Array(
                           Discriminators.MemberInfo.PropertyDiscriminator,
                           declType,
                           Json.Expression.String(_property.Name)
                           ));
            }
        }
示例#2
0
        public override Json.Expression ToJson(SerializationDomain domain)
        {
            var count = _parameters.Length;

            var parameters = new Json.Expression[count];

            for (var i = 0; i < count; i++)
            {
                parameters[i] = _parameters[i].ToJson();
            }

            return(Json.Expression.Array(
                       Discriminators.MemberInfo.ConstructorDiscriminator,
                       DeclaringType.ToJson(),
                       Json.Expression.Array(parameters)
                       ));
        }
示例#3
0
        public override Json.Expression ToJson(SerializationDomain domain)
        {
            var count = Parameters.Length;

            var parameters = new Json.Expression[count];

            for (var i = 0; i < count; i++)
            {
                parameters[i] = Parameters[i].ToJson();
            }

            return(Json.Expression.Array(
                       Discriminators.MemberInfo.SimpleMethodDiscriminator,
                       DeclaringType.ToJson(),
                       Json.Expression.String(((SimpleMethodInfoSlim)Method).Name),
                       Json.Expression.Array(parameters),
                       ReturnType.ToJson()
                       ));
        }
示例#4
0
 public override Json.Expression ToJson(SerializationDomain domain)
 {
     if (!domain.IsV08 && _field.FieldType != null)
     {
         return(Json.Expression.Array(
                    Discriminators.MemberInfo.FieldDiscriminator,
                    DeclaringType.ToJson(),
                    Json.Expression.String(_field.Name),
                    domain.AddType(_field.FieldType).ToJson()
                    ));
     }
     else
     {
         return(Json.Expression.Array(
                    Discriminators.MemberInfo.FieldDiscriminator,
                    DeclaringType.ToJson(),
                    Json.Expression.String(_field.Name)
                    ));
     }
 }
        public override Json.Expression ToJson(SerializationDomain domain)
        {
            var count = Parameters.Length;

            var parameters = new Json.Expression[count];

            for (var i = 0; i < count; i++)
            {
                parameters[i] = Parameters[i].ToJson();
            }

            var genericMethod = (GenericDefinitionMethodInfoSlim)Method;

            return(Json.Expression.Array(
                       Discriminators.MemberInfo.OpenGenericMethodDiscriminator,
                       DeclaringType.ToJson(),
                       Json.Expression.String(genericMethod.Name),
                       genericMethod.GenericParameterTypes.Count.ToJsonNumber(),
                       Json.Expression.Array(parameters),
                       ReturnType.ToJson()
                       ));
        }