Exemple #1
0
        public static StageItem Stage(string name, object value)
        {
            if (value == null)
            {
                return(new StageNull(name));
            }
            Type type = value.GetType();
            IPrepareForSerialization prepareForSerialization = value as IPrepareForSerialization;

            if (prepareForSerialization != null)
            {
                prepareForSerialization.Prepare();
            }
            IStager stager = SerializationMaster.GetStager(type);

            if (stager != null)
            {
                return(stager.StageValue(name, value));
            }
            IValueConverter converter = SerializationMaster.GetConverter(type);

            if (converter == null)
            {
                return(SerializationMaster.ReflectOut(name, value));
            }
            return(new StageValue(name, converter.ToString(value), type == SerializationMaster._stringType));
        }