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
- UnsafePeerToPeerMethods.cs
- XXXInfos.cs
- StringAnimationBase.cs
- WeakReferenceEnumerator.cs
- ExpressionWriter.cs
- BaseParser.cs
- linebase.cs
- _emptywebproxy.cs
- LiteralControl.cs
- TextWriterTraceListener.cs
- LeafCellTreeNode.cs
- ValueConversionAttribute.cs
- baseaxisquery.cs
- SevenBitStream.cs
- HistoryEventArgs.cs
- Bidi.cs
- Odbc32.cs
- documentsequencetextpointer.cs
- ConditionedDesigner.cs
- PropertyGridView.cs
- AtomEntry.cs
- ReflectionUtil.cs
- IISUnsafeMethods.cs
- AuthenticationService.cs
- Oid.cs
- StorageEntityContainerMapping.cs
- WebCategoryAttribute.cs
- WindowsTab.cs
- DispatcherExceptionEventArgs.cs
- DataGridHyperlinkColumn.cs
- QilLoop.cs
- KerberosTokenFactoryCredential.cs
- PeerPresenceInfo.cs
- Win32.cs
- PassportAuthentication.cs
- ParameterElement.cs
- _ListenerResponseStream.cs
- FtpCachePolicyElement.cs
- Brush.cs
- ToolStripSplitButton.cs
- MailMessage.cs
- CodeRemoveEventStatement.cs
- PkcsUtils.cs
- SqlResolver.cs
- GridToolTip.cs
- LogReserveAndAppendState.cs
- BufferModesCollection.cs
- ForEachAction.cs
- Debugger.cs
- ToolboxBitmapAttribute.cs
- ping.cs
- Calendar.cs
- AssemblySettingAttributes.cs
- FileInfo.cs
- ReturnEventArgs.cs
- TypeConstant.cs
- SafeFileMappingHandle.cs
- DataRelationCollection.cs
- WizardPanel.cs
- PseudoWebRequest.cs
- _SslState.cs
- NetSectionGroup.cs
- CompilerInfo.cs
- ClientScriptManager.cs
- CellQuery.cs
- RecordManager.cs
- XmlSchemaAttributeGroupRef.cs
- MachineKeyConverter.cs
- WebBrowserSiteBase.cs
- Emitter.cs
- AbsoluteQuery.cs
- RichTextBoxAutomationPeer.cs
- WebZone.cs
- MetadataUtil.cs
- EnvironmentPermission.cs
- EventSinkHelperWriter.cs
- PermissionListSet.cs
- ChangesetResponse.cs
- filewebresponse.cs
- TableRowGroup.cs
- ServiceCredentials.cs
- FileChangesMonitor.cs
- ToolZone.cs
- RijndaelManagedTransform.cs
- CodeDomSerializerBase.cs
- ProfileGroupSettings.cs
- XPathScanner.cs
- SourceFilter.cs
- EarlyBoundInfo.cs
- ObjectListGeneralPage.cs
- MessageBox.cs
- FormatterServices.cs
- ResolvedKeyFrameEntry.cs
- ValueType.cs
- WsrmFault.cs
- Latin1Encoding.cs
- ProviderUtil.cs
- SignedInfo.cs
- InstanceNameConverter.cs
- SecUtil.cs