コード例 #1
0
        internal Result(bool isFailure, T value, string error)
        {
            if (!isFailure && value == null)
            {
                throw new ArgumentNullException(nameof(value));
            }

            _logic = ResultCommonLogic.Create(isFailure, error);
            _value = value;
        }
コード例 #2
0
        public Result(SerializationInfo oInfo, StreamingContext oContext)
        {
            var isFailure = oInfo.GetBoolean("IsFailure");

            if (isFailure)
            {
                var error = oInfo.GetString("Error");
                _logic = ResultCommonLogic.Create(isFailure, error);
                _value = default;
            }
            else
            {
                _logic = ResultCommonLogic.Create(isFailure, null);
                var value = (T)oInfo.GetValue("Value", typeof(T));
                _value = value;
            }
        }
コード例 #3
0
 internal Result(bool isFailure, T value, string error)
 {
     _logic = ResultCommonLogic.Create(isFailure, error);
     _value = value;
 }