Repository: dotnet/runtime
File: src/libraries/System.Security.Cryptography/src/System/Security/Cryptography/X509Certificates/X509ChainPolicy.cs (C#)

Code before:
                VerificationTimeIgnored = false;
            }
        }

        public TimeSpan UrlRetrievalTimeout { get; set; }

        public void Reset()
        {
            _applicationPolicy = null;
            _certificatePolicy = null;
            _extraStore = null;
            _customTrustStore = null;
            DisableCertificateDownloads = false;
            _revocationMode = X509RevocationMode.Online;
            _revocationFlag = X509RevocationFlag.ExcludeRoot;
            _verificationFlags = X509VerificationFlags.NoFlag;
            _trustMode = X509ChainTrustMode.System;
            _verificationTime = DateTime.Now;
            VerificationTimeIgnored = true;

            UrlRetrievalTimeout = TimeSpan.Zero; // default timeout
        }

        public X509ChainPolicy Clone()
        {
            return (X509ChainPolicy)MemberwiseClone();
        }
    }
}


Review comment (suggestion):
I want this written by hand.

```suggestion
            X509ChainPolicy clone = new X509ChainPolicy
            {
                DisableCertificateDownloads = DisableCertificateDownloads,
                _revocationMode = _revocationMode,
                _revocationFlag = _revocationFlag,
                _verificationFlags = _verificationFlags,
                _trustMode = _trustMode,
                _verificationTime = _verificationTime,
                VerificationTimeIgnored = VerificationTimeIgnored,
                UrlRetrievalTimeout = UrlRetrievalTimeout,
            };
            
            if (_applicationPolicy?.Count > 0)
            {
                clone.ApplicationPolicy.AddRange(_applicationPolicy);
            }
            
            if (_certificatePolicy?.Count > 0)
            {
                ...
            }
            
            if (_customTrustStore?.Count > 0)
            {
                ...
            }
        }
```

And then in tests, `Assert.NotSame(orig.ApplicationPolicy, clone.ApplicationPolicy);` and `Assert.Equal(orig.ApplicationPolicy, clone.ApplicationPolicy);` (and similar for the other collections)

Code after:
                _verificationTime = value;
                VerificationTimeIgnored = false;
            }
        }

        public TimeSpan UrlRetrievalTimeout { get; set; }

        public void Reset()
        {
            _applicationPolicy = null;
            _certificatePolicy = null;
            _extraStore = null;
            _customTrustStore = null;
            DisableCertificateDownloads = false;
            _revocationMode = X509RevocationMode.Online;
            _revocationFlag = X509RevocationFlag.ExcludeRoot;
            _verificationFlags = X509VerificationFlags.NoFlag;
            _trustMode = X509ChainTrustMode.System;
            _verificationTime = DateTime.Now;
            VerificationTimeIgnored = true;
            UrlRetrievalTimeout = TimeSpan.Zero; // default timeout
        }

        public X509ChainPolicy Clone()
        {
            X509ChainPolicy clone = new X509ChainPolicy
            {
                DisableCertificateDownloads = DisableCertificateDownloads,
                _revocationMode = _revocationMode,
                _revocationFlag = _revocationFlag,
                _verificationFlags = _verificationFlags,
                _trustMode = _trustMode,
                _verificationTime = _verificationTime,
                VerificationTimeIgnored = VerificationTimeIgnored,
                UrlRetrievalTimeout = UrlRetrievalTimeout,
            };

            if (_applicationPolicy?.Count > 0)
            {
                foreach (var item in _applicationPolicy)
                {
                    clone.ApplicationPolicy.Add(item);
                }
            }

            if (_certificatePolicy?.Count > 0)
            {
                foreach (var item in _certificatePolicy)
                {
                    clone.CertificatePolicy.Add(item);
                }