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
- BitmapSourceSafeMILHandle.cs
- XPathNavigatorKeyComparer.cs
- TreeNodeCollection.cs
- Attachment.cs
- Transform.cs
- CultureTable.cs
- HttpRequest.cs
- Margins.cs
- PolyLineSegmentFigureLogic.cs
- ClrPerspective.cs
- UriParserTemplates.cs
- DetailsView.cs
- Int64.cs
- GeometryConverter.cs
- ContentPropertyAttribute.cs
- InkCanvasAutomationPeer.cs
- WebPartEventArgs.cs
- Thumb.cs
- ScrollChrome.cs
- CharacterBuffer.cs
- DropShadowBitmapEffect.cs
- DependencyPropertyChangedEventArgs.cs
- TypeCodeDomSerializer.cs
- ColorAnimationUsingKeyFrames.cs
- FloatUtil.cs
- SqlDataSourceQueryConverter.cs
- XappLauncher.cs
- IntPtr.cs
- TemplateField.cs
- FrameworkPropertyMetadata.cs
- SqlParameterizer.cs
- RowSpanVector.cs
- WindowsNonControl.cs
- WebColorConverter.cs
- TextParagraphCache.cs
- HttpModuleActionCollection.cs
- ReadOnlyCollectionBase.cs
- VisualCollection.cs
- AnimationLayer.cs
- HttpStreamMessage.cs
- odbcmetadatacolumnnames.cs
- CacheRequest.cs
- SuppressMessageAttribute.cs
- NewArrayExpression.cs
- SqlMethodTransformer.cs
- ByteArrayHelperWithString.cs
- SqlBulkCopy.cs
- FormsIdentity.cs
- Rule.cs
- ControlIdConverter.cs
- WinFormsSpinner.cs
- TransformPattern.cs
- Debugger.cs
- AvTrace.cs
- XPathBuilder.cs
- MsmqChannelFactory.cs
- Decoder.cs
- WebPartVerb.cs
- ArraySet.cs
- AsymmetricAlgorithm.cs
- ImageDrawing.cs
- ParameterBuilder.cs
- SecurityHelper.cs
- ExpressionEditorSheet.cs
- ValidationPropertyAttribute.cs
- x509utils.cs
- MarginsConverter.cs
- RemotingConfigParser.cs
- TextAnchor.cs
- RecipientInfo.cs
- DependencyPropertyDescriptor.cs
- _TransmitFileOverlappedAsyncResult.cs
- TreeNode.cs
- QuaternionAnimation.cs
- HtmlMeta.cs
- cookiecollection.cs
- Line.cs
- ImageClickEventArgs.cs
- RequestContext.cs
- DataServiceClientException.cs
- UIAgentCrashedException.cs
- TextElement.cs
- Registry.cs
- QueryAccessibilityHelpEvent.cs
- PagerStyle.cs
- ComponentManagerBroker.cs
- SqlTopReducer.cs
- CookieHandler.cs
- EntityConnection.cs
- TableItemProviderWrapper.cs
- ExpandoClass.cs
- ZoomComboBox.cs
- TextRange.cs
- TextViewElement.cs
- _WinHttpWebProxyDataBuilder.cs
- ScriptControlDescriptor.cs
- RecognitionEventArgs.cs
- MenuItemBinding.cs
- WebUtil.cs
- CodeThrowExceptionStatement.cs