Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / whidbey / NetFxQFE / ndp / clr / src / BCL / System / Reflection / __Filters.cs / 1 / __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
- NetCodeGroup.cs
- NetNamedPipeBindingCollectionElement.cs
- URIFormatException.cs
- TraceListeners.cs
- HtmlDocument.cs
- ConnectionConsumerAttribute.cs
- ReadWriteObjectLock.cs
- HtmlControl.cs
- AppLevelCompilationSectionCache.cs
- PixelFormatConverter.cs
- ObjectReaderCompiler.cs
- DbProviderFactories.cs
- ConnectionDemuxer.cs
- PkcsMisc.cs
- RadioButtonFlatAdapter.cs
- Choices.cs
- ArrayElementGridEntry.cs
- hwndwrapper.cs
- CallInfo.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- OleDbErrorCollection.cs
- XmlSchemaFacet.cs
- RecipientInfo.cs
- WindowsStartMenu.cs
- VectorValueSerializer.cs
- Model3DCollection.cs
- StyleXamlTreeBuilder.cs
- EdmComplexTypeAttribute.cs
- TokenFactoryBase.cs
- XpsDocument.cs
- StateInitializationDesigner.cs
- EntityContainerEntitySet.cs
- FlowDocumentFormatter.cs
- _Events.cs
- MenuItemBinding.cs
- CharEnumerator.cs
- ListBoxItemAutomationPeer.cs
- DataGridBoolColumn.cs
- BindableTemplateBuilder.cs
- HttpCapabilitiesSectionHandler.cs
- DataErrorValidationRule.cs
- EdgeModeValidation.cs
- NullExtension.cs
- ChangeBlockUndoRecord.cs
- InvalidContentTypeException.cs
- WeakReferenceEnumerator.cs
- AttributeQuery.cs
- BitmapFrameDecode.cs
- ValidationErrorCollection.cs
- WebPartHeaderCloseVerb.cs
- SafeNativeMethodsOther.cs
- AddInController.cs
- DelegateSerializationHolder.cs
- followingquery.cs
- LinqDataSourceEditData.cs
- TextUtf8RawTextWriter.cs
- MembershipUser.cs
- DataContractAttribute.cs
- CompilationSection.cs
- IntMinMaxAggregationOperator.cs
- BooleanSwitch.cs
- AccessDataSourceView.cs
- BaseCodeDomTreeGenerator.cs
- Crypto.cs
- CookieProtection.cs
- WbemProvider.cs
- ScrollItemProviderWrapper.cs
- SoapFormatter.cs
- COM2Enum.cs
- ImagingCache.cs
- WCFServiceClientProxyGenerator.cs
- HostProtectionException.cs
- HelpEvent.cs
- Main.cs
- EdmItemError.cs
- WorkflowRequestContext.cs
- EntityDataSourceQueryBuilder.cs
- DefaultPerformanceCounters.cs
- SchemaTableColumn.cs
- ECDsaCng.cs
- DocumentXmlWriter.cs
- SqlConnectionPoolGroupProviderInfo.cs
- WebPartActionVerb.cs
- BinaryFormatterWriter.cs
- mactripleDES.cs
- XmlAnyElementAttributes.cs
- DbParameterCollectionHelper.cs
- PropertyMapper.cs
- DescendentsWalkerBase.cs
- ChannelCredentials.cs
- UxThemeWrapper.cs
- BrowserDefinitionCollection.cs
- BitVec.cs
- Thread.cs
- BitHelper.cs
- XamlPathDataSerializer.cs
- ConsoleCancelEventArgs.cs
- WebPartCloseVerb.cs
- Comparer.cs
- WmlValidationSummaryAdapter.cs