Esempio n. 1
0
        public static bool TryConvertFrom(ISsslConverter converter, object value, [NotNullWhen(true)] out SsslObject result)
        {
            var type   = value.GetType();
            var obj    = new SsslRecord(SsslRecordType.Braces, type.GetFullName());
            var values = GetModelInfo(type).ConvertFrom(value);

            foreach (var(name, val) in values)
            {
                if (!converter.TryConvertFrom(val, out var ssslVal))
                {
                    result = null !;
                    return(false);
                }

                obj[name] = ssslVal;
            }

            result = obj;
            return(true);
        }