Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / clr / src / BCL / System / Reflection / __Filters.cs / 1305376 / __Filters.cs
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
// [....]
//
// This class defines the delegate methods for the COM+ implemented filters.
// This is the reflection version of these. There is also a _Filters class in
// runtime which is related to this.
//
//
//
//
namespace System.Reflection {
using System;
using System.Globalization;
//<
[Serializable]
internal class __Filters {
// FilterTypeName
// This method will filter the class based upon the name. It supports
// a trailing wild card.
public virtual bool FilterTypeName(Type cls,Object filterCriteria)
{
// Check that the criteria object is a String object
if (filterCriteria == null || !(filterCriteria is String))
throw new InvalidFilterCriteriaException(System.Environment.GetResourceString("RFLCT.FltCritString"));
String str = (String) filterCriteria;
//str = str.Trim();
// Check to see if this is a prefix or exact match requirement
if (str.Length > 0 && str[str.Length - 1] == '*') {
str = str.Substring(0, str.Length - 1);
return cls.Name.StartsWith(str, StringComparison.Ordinal);
}
return cls.Name.Equals(str);
}
// FilterFieldNameIgnoreCase
// This method filter the Type based upon name, it ignores case.
public virtual bool FilterTypeNameIgnoreCase(Type cls, Object filterCriteria)
{
// Check that the criteria object is a String object
if(filterCriteria == null || !(filterCriteria is String))
throw new InvalidFilterCriteriaException(System.Environment.GetResourceString("RFLCT.FltCritString"));
String str = (String) filterCriteria;
//str = str.Trim();
// Check to see if this is a prefix or exact match requirement
if (str.Length > 0 && str[str.Length - 1] == '*') {
str = str.Substring(0, str.Length - 1);
String name = cls.Name;
if (name.Length >= str.Length)
return (String.Compare(name,0,str,0,str.Length, StringComparison.OrdinalIgnoreCase)==0);
else
return false;
}
return (String.Compare(str,cls.Name, StringComparison.OrdinalIgnoreCase) == 0);
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
////////////////////////////////////////////////////////////////////////////////
////////////////////////////////////////////////////////////////////////////////
//
// [....]
//
// This class defines the delegate methods for the COM+ implemented filters.
// This is the reflection version of these. There is also a _Filters class in
// runtime which is related to this.
//
//
//
//
namespace System.Reflection {
using System;
using System.Globalization;
//<
[Serializable]
internal class __Filters {
// FilterTypeName
// This method will filter the class based upon the name. It supports
// a trailing wild card.
public virtual bool FilterTypeName(Type cls,Object filterCriteria)
{
// Check that the criteria object is a String object
if (filterCriteria == null || !(filterCriteria is String))
throw new InvalidFilterCriteriaException(System.Environment.GetResourceString("RFLCT.FltCritString"));
String str = (String) filterCriteria;
//str = str.Trim();
// Check to see if this is a prefix or exact match requirement
if (str.Length > 0 && str[str.Length - 1] == '*') {
str = str.Substring(0, str.Length - 1);
return cls.Name.StartsWith(str, StringComparison.Ordinal);
}
return cls.Name.Equals(str);
}
// FilterFieldNameIgnoreCase
// This method filter the Type based upon name, it ignores case.
public virtual bool FilterTypeNameIgnoreCase(Type cls, Object filterCriteria)
{
// Check that the criteria object is a String object
if(filterCriteria == null || !(filterCriteria is String))
throw new InvalidFilterCriteriaException(System.Environment.GetResourceString("RFLCT.FltCritString"));
String str = (String) filterCriteria;
//str = str.Trim();
// Check to see if this is a prefix or exact match requirement
if (str.Length > 0 && str[str.Length - 1] == '*') {
str = str.Substring(0, str.Length - 1);
String name = cls.Name;
if (name.Length >= str.Length)
return (String.Compare(name,0,str,0,str.Length, StringComparison.OrdinalIgnoreCase)==0);
else
return false;
}
return (String.Compare(str,cls.Name, StringComparison.OrdinalIgnoreCase) == 0);
}
}
}
// 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
- EndpointIdentityConverter.cs
- HGlobalSafeHandle.cs
- EarlyBoundInfo.cs
- UriSection.cs
- SecurityRuntime.cs
- XmlValidatingReader.cs
- DataRelationCollection.cs
- InputManager.cs
- DataServiceQueryProvider.cs
- NullEntityWrapper.cs
- XmlSignatureProperties.cs
- SqlBuffer.cs
- GregorianCalendarHelper.cs
- DotExpr.cs
- DataObjectCopyingEventArgs.cs
- ConstraintCollection.cs
- ToggleButtonAutomationPeer.cs
- Configuration.cs
- XmlCharType.cs
- MethodBody.cs
- ScrollContentPresenter.cs
- UserControl.cs
- NativeMethods.cs
- SoapCommonClasses.cs
- NullReferenceException.cs
- BufferedReceiveManager.cs
- NumberSubstitution.cs
- RegexGroupCollection.cs
- OdbcReferenceCollection.cs
- PropertyDescriptorComparer.cs
- SignatureToken.cs
- ModelVisual3D.cs
- HttpPostProtocolReflector.cs
- Visual3D.cs
- _SSPISessionCache.cs
- XXXOnTypeBuilderInstantiation.cs
- FilterException.cs
- SystemNetHelpers.cs
- DoubleLinkListEnumerator.cs
- CharacterHit.cs
- ShapingEngine.cs
- ListenDesigner.cs
- TypeConverterValueSerializer.cs
- TextPenaltyModule.cs
- SettingsPropertyCollection.cs
- MDIClient.cs
- SqlConnectionHelper.cs
- ObjectDataSourceEventArgs.cs
- Compiler.cs
- MembershipUser.cs
- SafeLibraryHandle.cs
- PageParser.cs
- GridViewCancelEditEventArgs.cs
- PrintPreviewGraphics.cs
- WebFaultException.cs
- OdbcConnection.cs
- nulltextcontainer.cs
- EditorAttributeInfo.cs
- DecimalStorage.cs
- XamlReader.cs
- SourceCollection.cs
- dataobject.cs
- AdapterUtil.cs
- RegexCapture.cs
- BitmapEffectrendercontext.cs
- CurrentChangingEventManager.cs
- IPAddress.cs
- ErrorFormatter.cs
- VisualSerializer.cs
- OleDbStruct.cs
- BlobPersonalizationState.cs
- MimeReturn.cs
- Pair.cs
- XamlPathDataSerializer.cs
- TextTreeExtractElementUndoUnit.cs
- HttpContextBase.cs
- LassoHelper.cs
- TreeNodeStyleCollection.cs
- XmlSchemaAny.cs
- XsdDataContractExporter.cs
- GenericRootAutomationPeer.cs
- CollectionBuilder.cs
- DrawToolTipEventArgs.cs
- DelegatingTypeDescriptionProvider.cs
- SelectQueryOperator.cs
- IxmlLineInfo.cs
- TextDpi.cs
- CharAnimationBase.cs
- FormViewModeEventArgs.cs
- RequestQueue.cs
- HttpWebRequest.cs
- RuleSetReference.cs
- PersonalizationProviderCollection.cs
- RectAnimationUsingKeyFrames.cs
- Encoder.cs
- DataGridViewDataErrorEventArgs.cs
- SafeNativeMethods.cs
- XmlBufferReader.cs
- DataControlFieldCell.cs
- TreeViewImageIndexConverter.cs