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
- AuthenticatingEventArgs.cs
- NegotiationTokenAuthenticator.cs
- SpeechRecognizer.cs
- OdbcHandle.cs
- XMLSchema.cs
- InvalidFilterCriteriaException.cs
- BamlResourceDeserializer.cs
- XPathParser.cs
- XmlReader.cs
- ActiveXSite.cs
- ModelItemExtensions.cs
- PopupRootAutomationPeer.cs
- IncrementalCompileAnalyzer.cs
- Timer.cs
- DelegateBodyWriter.cs
- SspiSafeHandles.cs
- TableDetailsCollection.cs
- linebase.cs
- XAMLParseException.cs
- LOSFormatter.cs
- ProjectionPruner.cs
- ListCollectionView.cs
- SubMenuStyle.cs
- DesignerView.xaml.cs
- TypeDescriptor.cs
- WindowsStatusBar.cs
- CorruptStoreException.cs
- Renderer.cs
- ReadOnlyDictionary.cs
- ListControlStringCollectionEditor.cs
- DataTableMappingCollection.cs
- FileAuthorizationModule.cs
- MachineKeyValidationConverter.cs
- URLString.cs
- EndPoint.cs
- InfoCardRSAPKCS1SignatureFormatter.cs
- Quaternion.cs
- ImageCodecInfo.cs
- UserNameSecurityTokenProvider.cs
- AttributeCollection.cs
- EntityDesignerBuildProvider.cs
- BitmapEffectDrawingContextWalker.cs
- FormViewUpdateEventArgs.cs
- AmbiguousMatchException.cs
- NamedPipeConnectionPoolSettingsElement.cs
- InvariantComparer.cs
- ProfileProvider.cs
- LogReservationCollection.cs
- BinHexEncoder.cs
- TextServicesCompartmentContext.cs
- AttachmentCollection.cs
- RevocationPoint.cs
- TabItemAutomationPeer.cs
- SchemaObjectWriter.cs
- TextUtf8RawTextWriter.cs
- ColumnHeaderConverter.cs
- WSHttpBinding.cs
- CompilationUnit.cs
- glyphs.cs
- Rule.cs
- WorkflowTraceTransfer.cs
- GetKeyedHashRequest.cs
- SinglePageViewer.cs
- SafeNativeMethods.cs
- MemoryMappedFile.cs
- ImageDrawing.cs
- SamlAssertion.cs
- MemberRelationshipService.cs
- TextDecorationLocationValidation.cs
- InputLanguageCollection.cs
- ToolStripPanelRow.cs
- PackWebRequest.cs
- AppModelKnownContentFactory.cs
- AssemblyAttributesGoHere.cs
- CfgParser.cs
- DataContractSerializer.cs
- GestureRecognitionResult.cs
- ControlCollection.cs
- CommonServiceBehaviorElement.cs
- EntityDataSourceChangedEventArgs.cs
- WindowsMenu.cs
- TableHeaderCell.cs
- RelationshipEndCollection.cs
- HtmlInputFile.cs
- ConfigurationValues.cs
- RSAOAEPKeyExchangeDeformatter.cs
- EasingKeyFrames.cs
- ObjectRef.cs
- SQLDouble.cs
- __ConsoleStream.cs
- ServiceHttpHandlerFactory.cs
- HttpDebugHandler.cs
- VisualState.cs
- XamlToRtfWriter.cs
- LayoutSettings.cs
- Tile.cs
- ClientTarget.cs
- OutputCacheEntry.cs
- PropertyCollection.cs
- PtsCache.cs