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
- MetabaseSettings.cs
- ParameterToken.cs
- SchemaTypeEmitter.cs
- Registry.cs
- Array.cs
- RegexCharClass.cs
- Size3DConverter.cs
- ProfilePropertyNameValidator.cs
- EventHandlerList.cs
- ProxyWebPartManager.cs
- _ProxyRegBlob.cs
- mediaeventargs.cs
- TableRowCollection.cs
- SourceFileBuildProvider.cs
- GridViewColumnHeader.cs
- DrawingContext.cs
- FileSystemInfo.cs
- ItemsPresenter.cs
- X509Certificate2.cs
- IResourceProvider.cs
- Trace.cs
- ReflectEventDescriptor.cs
- ProtectedUri.cs
- ListCollectionView.cs
- DbDataSourceEnumerator.cs
- WebBrowser.cs
- GroupLabel.cs
- FontFamilyConverter.cs
- GlyphRun.cs
- HwndStylusInputProvider.cs
- DoubleLinkListEnumerator.cs
- NativeMethods.cs
- VectorKeyFrameCollection.cs
- precedingsibling.cs
- FormsAuthentication.cs
- RegexTree.cs
- InputBuffer.cs
- FileDialogPermission.cs
- WebPartActionVerb.cs
- DataGridViewCellValueEventArgs.cs
- SerializerDescriptor.cs
- HtmlInputReset.cs
- DocobjHost.cs
- OdbcReferenceCollection.cs
- LongTypeConverter.cs
- TimeSpanConverter.cs
- GridErrorDlg.cs
- NegatedConstant.cs
- DefaultAutoFieldGenerator.cs
- RelationshipConverter.cs
- QueryOutputWriterV1.cs
- EmptyCollection.cs
- SqlTopReducer.cs
- TypeUtils.cs
- WindowPattern.cs
- ClrPerspective.cs
- CompleteWizardStep.cs
- ThreadExceptionDialog.cs
- TextBoxBase.cs
- BaseCodePageEncoding.cs
- VisualStateManager.cs
- PersonalizationProvider.cs
- webproxy.cs
- ItemChangedEventArgs.cs
- InternalTransaction.cs
- BasicExpandProvider.cs
- EmptyEnumerator.cs
- RoleBoolean.cs
- TreeChangeInfo.cs
- AsymmetricSignatureFormatter.cs
- HandlerWithFactory.cs
- ContentTextAutomationPeer.cs
- ExpressionBinding.cs
- UpdatePanelTrigger.cs
- WebContext.cs
- ResourceWriter.cs
- EntityContainerEntitySet.cs
- SecureUICommand.cs
- DbParameterHelper.cs
- CqlBlock.cs
- WpfKnownType.cs
- ContractMapping.cs
- ModelTreeManager.cs
- OdbcConnection.cs
- SspiSafeHandles.cs
- TreeIterator.cs
- ToolStripDropDownMenu.cs
- ColorKeyFrameCollection.cs
- StorageComplexTypeMapping.cs
- PersianCalendar.cs
- ObservableCollectionDefaultValueFactory.cs
- ButtonColumn.cs
- SingleTagSectionHandler.cs
- CompilerResults.cs
- DeleteHelper.cs
- PropertyGeneratedEventArgs.cs
- ComponentRenameEvent.cs
- OrderedParallelQuery.cs
- DetailsViewCommandEventArgs.cs
- CanonicalFormWriter.cs