Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx35 / System.ServiceModel.Web / System / ServiceModel / Configuration / InternalEnumValidator.cs / 1305376 / InternalEnumValidator.cs
//------------------------------------------------------------------------------ // Copyright (c) Microsoft Corporation. All rights reserved. //----------------------------------------------------------------------------- namespace System.ServiceModel.Configuration { using System; using System.ComponentModel; using System.Configuration; using System.Reflection; using System.ServiceModel.Channels; internal class InternalEnumValidator : ConfigurationValidatorBase { Type enumHelperType; MethodInfo isDefined; public InternalEnumValidator(Type enumHelperType) { this.enumHelperType = enumHelperType; this.isDefined = this.enumHelperType.GetMethod("IsDefined", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public); } public override bool CanValidate(Type type) { return (this.isDefined != null); } public override void Validate(object value) { bool retVal = (bool) this.isDefined.Invoke(null, new object[] { value }); if (!retVal) { ParameterInfo[] isDefinedParameters = this.isDefined.GetParameters(); throw DiagnosticUtility.ExceptionUtility.ThrowHelperError(new InvalidEnumArgumentException("value", (int) value, isDefinedParameters[0].ParameterType)); } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XamlSerializer.cs
- ServicesUtilities.cs
- PropertyEmitterBase.cs
- ProcessInfo.cs
- AsyncCompletedEventArgs.cs
- CursorEditor.cs
- HashHelper.cs
- ReliableSession.cs
- Sentence.cs
- ChangeConflicts.cs
- ToolStripScrollButton.cs
- InvalidateEvent.cs
- Vector3DCollectionValueSerializer.cs
- DbConnectionPoolCounters.cs
- ButtonPopupAdapter.cs
- GeometryConverter.cs
- Root.cs
- TreeNodeStyle.cs
- WebPartTransformerCollection.cs
- WebControl.cs
- SchemaObjectWriter.cs
- SystemWebExtensionsSectionGroup.cs
- EdmType.cs
- PropertyGridCommands.cs
- SynchronizedCollection.cs
- QueryResponse.cs
- FontStretches.cs
- BitStack.cs
- smtppermission.cs
- OdbcCommandBuilder.cs
- ServicePointManager.cs
- NativeMethods.cs
- ReadOnlyObservableCollection.cs
- UpdateRecord.cs
- RawStylusInputReport.cs
- ToolBar.cs
- AnchoredBlock.cs
- ElementHost.cs
- RSAOAEPKeyExchangeDeformatter.cs
- OleDbPropertySetGuid.cs
- ComponentConverter.cs
- GeneralTransformGroup.cs
- StringOutput.cs
- UInt16.cs
- XmlSerializerNamespaces.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- AnchorEditor.cs
- SubpageParagraph.cs
- EditBehavior.cs
- CheckedListBox.cs
- ConfigurationElementCollection.cs
- PageHandlerFactory.cs
- httpapplicationstate.cs
- StylusPoint.cs
- FilterableAttribute.cs
- InputMethodStateTypeInfo.cs
- SerializationFieldInfo.cs
- Quaternion.cs
- FastEncoder.cs
- PropertyEntry.cs
- FileDialogPermission.cs
- DesigntimeLicenseContextSerializer.cs
- WebBrowserProgressChangedEventHandler.cs
- EndOfStreamException.cs
- URL.cs
- RadioButtonAutomationPeer.cs
- DataGridViewRowHeaderCell.cs
- NetworkInterface.cs
- ExpressionBuilderCollection.cs
- DESCryptoServiceProvider.cs
- Duration.cs
- DefaultValueAttribute.cs
- HttpRawResponse.cs
- XmlSerializer.cs
- ToolStripMenuItemDesigner.cs
- Effect.cs
- UseLicense.cs
- DefaultSection.cs
- SoapExtensionStream.cs
- Number.cs
- XmlValueConverter.cs
- MaskInputRejectedEventArgs.cs
- ToggleButton.cs
- GridViewDeletedEventArgs.cs
- Int64.cs
- ILGenerator.cs
- PolyBezierSegment.cs
- HttpListenerRequestUriBuilder.cs
- LockCookie.cs
- Rect3DValueSerializer.cs
- ThreadStaticAttribute.cs
- CultureMapper.cs
- StreamInfo.cs
- SecurityResources.cs
- QueryProcessor.cs
- AspCompat.cs
- ValidatingCollection.cs
- SafeSecurityHelper.cs
- Converter.cs
- PropertyFilter.cs