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
- UnsafeNativeMethods.cs
- XmlAttributeCache.cs
- AssemblyEvidenceFactory.cs
- FtpWebRequest.cs
- AddInControllerImpl.cs
- PathSegmentCollection.cs
- ListViewCancelEventArgs.cs
- ObjectManager.cs
- CacheChildrenQuery.cs
- ExtensionFile.cs
- ProfilePropertyNameValidator.cs
- SoapFormatter.cs
- ImageField.cs
- SortExpressionBuilder.cs
- UnescapedXmlDiagnosticData.cs
- DeliveryRequirementsAttribute.cs
- WebPartActionVerb.cs
- OracleDataAdapter.cs
- ImpersonateTokenRef.cs
- unsafeIndexingFilterStream.cs
- StreamGeometry.cs
- EventHandlingScope.cs
- StyleHelper.cs
- ExtensibleClassFactory.cs
- RequestCacheEntry.cs
- WebPartZone.cs
- PropertyInformationCollection.cs
- MatrixTransform.cs
- DataSourceHelper.cs
- WebPartDescriptionCollection.cs
- Hashtable.cs
- SHA1Managed.cs
- Transform3D.cs
- DelegateHelpers.cs
- CallbackValidator.cs
- BasicViewGenerator.cs
- ApplicationFileCodeDomTreeGenerator.cs
- MessageQueuePermissionEntryCollection.cs
- InstanceData.cs
- MonthCalendar.cs
- StringKeyFrameCollection.cs
- UnsafeNativeMethodsCLR.cs
- PathSegment.cs
- ModelPerspective.cs
- _ShellExpression.cs
- MembershipAdapter.cs
- ManagementOptions.cs
- ApplyImportsAction.cs
- Serializer.cs
- EventProvider.cs
- ChannelListenerBase.cs
- CryptoApi.cs
- InitializationEventAttribute.cs
- SqlDependency.cs
- Touch.cs
- SizeLimitedCache.cs
- MenuItemCollectionEditorDialog.cs
- XmlnsCache.cs
- ImportContext.cs
- TextSchema.cs
- XmlnsDefinitionAttribute.cs
- BitmapEffectrendercontext.cs
- XmlDocumentFragment.cs
- AuthenticatingEventArgs.cs
- GeneralTransform3DGroup.cs
- WindowsEditBox.cs
- VariableExpressionConverter.cs
- RSAProtectedConfigurationProvider.cs
- DesigntimeLicenseContextSerializer.cs
- StaticSiteMapProvider.cs
- FacetEnabledSchemaElement.cs
- BitVector32.cs
- GridViewSelectEventArgs.cs
- ILGenerator.cs
- TextShapeableCharacters.cs
- ValueConversionAttribute.cs
- SafeWaitHandle.cs
- BaseServiceProvider.cs
- TableLayoutPanelCellPosition.cs
- DataSetMappper.cs
- Int16.cs
- PeerApplicationLaunchInfo.cs
- JpegBitmapEncoder.cs
- DataGridHyperlinkColumn.cs
- HttpRuntimeSection.cs
- MenuItemCollectionEditor.cs
- ObjectListSelectEventArgs.cs
- ChannelCacheDefaults.cs
- BitmapMetadataBlob.cs
- AnimatedTypeHelpers.cs
- DateTimeConstantAttribute.cs
- LocalizationParserHooks.cs
- BinaryObjectWriter.cs
- _AutoWebProxyScriptHelper.cs
- DesignerAttribute.cs
- WebPartEditVerb.cs
- TripleDES.cs
- NativeCompoundFileAPIs.cs
- ControlBuilder.cs
- SQLConvert.cs