Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Regex / System / Text / RegularExpressions / RegexGroup.cs / 1 / RegexGroup.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- // Group represents the substring or substrings that // are captured by a single capturing group after one // regular expression match. namespace System.Text.RegularExpressions { using System.Security.Permissions; ////// Group /// represents the results from a single capturing group. A capturing group can /// capture zero, one, or more strings in a single match because of quantifiers, so /// Group supplies a collection of Capture objects. /// [ Serializable() ] public class Group : Capture { // the empty group object internal static Group _emptygroup = new Group(String.Empty, new int[0], 0); internal int[] _caps; internal int _capcount; internal CaptureCollection _capcoll; internal Group(String text, int[] caps, int capcount) : base(text, capcount == 0 ? 0 : caps[(capcount - 1) * 2], capcount == 0 ? 0 : caps[(capcount * 2) - 1]) { _caps = caps; _capcount = capcount; } /* * True if the match was successful */ ////// public bool Success { get { return _capcount != 0; } } /* * The collection of all captures for this group */ ///Indicates whether the match is successful. ////// public CaptureCollection Captures { get { if (_capcoll == null) _capcoll = new CaptureCollection(this); return _capcoll; } } /* * Convert to a thread-safe object by precomputing cache contents */ ////// Returns a collection of all the captures matched by the capturing /// group, in innermost-leftmost-first order (or innermost-rightmost-first order if /// compiled with the "r" option). The collection may have zero or more items. /// ////// [HostProtection(Synchronization=true)] static public Group Synchronized(Group inner) { if (inner == null) throw new ArgumentNullException("inner"); // force Captures to be computed. CaptureCollection capcoll; Capture dummy; capcoll = inner.Captures; if (inner._capcount > 0) dummy = capcoll[0]; return inner; } } }Returns /// a Group object equivalent to the one supplied that is safe to share between /// multiple threads. ///
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- XmlSchemaSimpleContentRestriction.cs
- recordstatescratchpad.cs
- InstallerTypeAttribute.cs
- DataGridViewColumnCollectionDialog.cs
- MultipleViewPattern.cs
- EncodingInfo.cs
- OutputCacheModule.cs
- CodeChecksumPragma.cs
- DrawListViewSubItemEventArgs.cs
- ChannelSettingsElement.cs
- EndpointReference.cs
- SamlSecurityToken.cs
- PageThemeCodeDomTreeGenerator.cs
- XamlDesignerSerializationManager.cs
- SqlInternalConnectionTds.cs
- CompilerScope.cs
- BasicViewGenerator.cs
- PrivateFontCollection.cs
- CodeBinaryOperatorExpression.cs
- StatusBarItemAutomationPeer.cs
- BindableAttribute.cs
- Stream.cs
- Marshal.cs
- PropertyMapper.cs
- ResourceReferenceKeyNotFoundException.cs
- BitHelper.cs
- XmlIgnoreAttribute.cs
- _RequestCacheProtocol.cs
- BrowsableAttribute.cs
- UserControlAutomationPeer.cs
- InitializerFacet.cs
- Wildcard.cs
- MediaPlayerState.cs
- BuilderInfo.cs
- ResXBuildProvider.cs
- RegexGroup.cs
- CacheDependency.cs
- CharacterMetricsDictionary.cs
- TreeNode.cs
- SecurityUtils.cs
- ping.cs
- SelectionItemProviderWrapper.cs
- httpserverutility.cs
- RectConverter.cs
- DrawingImage.cs
- EntityDataSourceState.cs
- MapPathBasedVirtualPathProvider.cs
- InputScopeNameConverter.cs
- WebPartConnectionCollection.cs
- BufferModeSettings.cs
- SQLInt16.cs
- HostedHttpContext.cs
- GridViewColumn.cs
- HttpHostedTransportConfiguration.cs
- OracleConnection.cs
- TypeUtils.cs
- NamespaceCollection.cs
- RtType.cs
- TextSelection.cs
- XPathNavigator.cs
- DataBinder.cs
- ProcessDesigner.cs
- MatrixTransform3D.cs
- WebBrowser.cs
- BooleanConverter.cs
- OdbcConnectionStringbuilder.cs
- SequentialUshortCollection.cs
- OutgoingWebResponseContext.cs
- RtfToXamlLexer.cs
- PerfCounters.cs
- CodeObject.cs
- DeferredSelectedIndexReference.cs
- HybridDictionary.cs
- ReadOnlyCollectionBase.cs
- Utils.cs
- SoapSchemaExporter.cs
- ConfigXmlCDataSection.cs
- ConfigXmlComment.cs
- PixelShader.cs
- WhitespaceRuleLookup.cs
- hresults.cs
- Math.cs
- LockRenewalTask.cs
- BCryptSafeHandles.cs
- ISAPIRuntime.cs
- WebPartMovingEventArgs.cs
- SectionUpdates.cs
- XmlSchemaComplexContentExtension.cs
- DispatcherEventArgs.cs
- XmlValidatingReaderImpl.cs
- OptimizerPatterns.cs
- XNodeNavigator.cs
- FontCollection.cs
- NavigatorInput.cs
- Accessible.cs
- SimpleTypeResolver.cs
- AuthorizationSection.cs
- StrokeSerializer.cs
- ElementAction.cs
- PreviewPageInfo.cs