コード例 #1
0
        public void EmptyWithRegeneratesType()
        {
            var empty = EmptyDerivedFromAbstract.Create();
            AbstractNonEmpty emptyAsBase = empty;

            EmptyDerivedFromAbstract newInstance       = empty.With(oneField: true);
            AbstractNonEmpty         newInstanceAsBase = emptyAsBase.With(oneField: true);

            Assert.Equal(empty.Identity, newInstance.Identity);
            Assert.Equal(empty.Identity, newInstanceAsBase.Identity);
        }
コード例 #2
0
        public virtual EmptyDerivedFromAbstract ToEmptyDerivedFromAbstract()
        {
            EmptyDerivedFromAbstract that = this as EmptyDerivedFromAbstract;

            if (that != null && this.GetType().IsEquivalentTo(typeof(EmptyDerivedFromAbstract)))
            {
                return(that);
            }

            return(EmptyDerivedFromAbstract.CreateWithIdentity(
                       oneField: Optional.For(this.OneField),
                       identity: this.Identity));
        }
コード例 #3
0
 public new EmptyDerivedFromAbstract ToImmutable()
 {
     return this.immutable = this.immutable;
 }
コード例 #4
0
 internal Builder(EmptyDerivedFromAbstract immutable)
     : base(immutable)
 {
     this.immutable = immutable;
 }
コード例 #5
0
 public new EmptyDerivedFromAbstract ToImmutable()
 {
     return(this.immutable = this.immutable);
 }
コード例 #6
0
 internal Builder(EmptyDerivedFromAbstract immutable) : base(immutable)
 {
     this.immutable = immutable;
 }