Beispiel #1
0
        protected PacketFieldInfo(PropertyInfo property, PacketFieldAttribute attribute)
        {
            Property  = property ?? throw new ArgumentNullException(nameof(property));
            Attribute = attribute ?? throw new ArgumentNullException(nameof(attribute));

            var type    = property.PropertyType;
            var isArray = type.IsConstructedGenericType &&
                          type.GetGenericTypeDefinition() == typeof(List <>);
            var elemType    = isArray ? type.GetGenericArguments()[0] : null;
            var isByteArray = elemType == typeof(byte);

            IsArray     = isArray && !isByteArray;
            IsByteArray = isArray && isByteArray;
            IsString    = type == typeof(string);
            IsPrimitive = IsPrimitiveType(type);
        }
 protected abstract PacketFieldInfo CreateFieldInfo(
     PropertyInfo property, PacketFieldAttribute attribute);