VersionValidator.cs source code in C# .NET

Source code for the .NET framework in C#

                        

Code:

/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / fx / src / xsp / System / Web / Configuration / VersionValidator.cs / 1305376 / VersionValidator.cs

                            //------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

namespace System.Web.Configuration { 
    using System; 
    using System.Configuration;
 
    internal sealed class VersionValidator : ConfigurationValidatorBase {
        private readonly Version _minimumVersion;

        public VersionValidator(Version minimumVersion) { 
            _minimumVersion = minimumVersion;
        } 
 
        public override bool CanValidate(Type type) {
            return typeof(Version).Equals(type); 
        }

        public override void Validate(object value) {
            if (value == null) { 
                throw new ArgumentNullException("value");
            } 
            if (((Version)value) < _minimumVersion) { 
                throw new ArgumentOutOfRangeException("value",
                    SR.GetString(SR.Config_control_rendering_compatibility_version_is_less_than_minimum_version)); 
            }
        }
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
//------------------------------------------------------------------------------ 
// 
//     Copyright (c) Microsoft Corporation.  All rights reserved.
// 
//----------------------------------------------------------------------------- 

namespace System.Web.Configuration { 
    using System; 
    using System.Configuration;
 
    internal sealed class VersionValidator : ConfigurationValidatorBase {
        private readonly Version _minimumVersion;

        public VersionValidator(Version minimumVersion) { 
            _minimumVersion = minimumVersion;
        } 
 
        public override bool CanValidate(Type type) {
            return typeof(Version).Equals(type); 
        }

        public override void Validate(object value) {
            if (value == null) { 
                throw new ArgumentNullException("value");
            } 
            if (((Version)value) < _minimumVersion) { 
                throw new ArgumentOutOfRangeException("value",
                    SR.GetString(SR.Config_control_rendering_compatibility_version_is_less_than_minimum_version)); 
            }
        }
    }
} 

// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
                        

Link Menu

Network programming in C#, Network Programming in VB.NET, Network Programming in .NET
This book is available now!
Buy at Amazon US or
Buy at Amazon UK