Code:
/ WCF / WCF / 3.5.30729.1 / untmp / Orcas / SP / ndp / cdf / src / NetFx35 / System.ServiceModel.Web / System / UriTemplateVariablePathSegment.cs / 1 / UriTemplateVariablePathSegment.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System { using System.Collections.Specialized; using System.ServiceModel; using System.ServiceModel.Web; using System.Text; class UriTemplateVariablePathSegment : UriTemplatePathSegment { readonly string varName; public UriTemplateVariablePathSegment(string originalSegment, bool endsWithSlash, string varName) : base(originalSegment, UriTemplatePartType.Variable, endsWithSlash) { Fx.Assert(!string.IsNullOrEmpty(varName), "bad variable segment"); this.varName = varName; } public string VarName { get { return this.varName; } } public override void Bind(string[] values, ref int valueIndex, StringBuilder path) { Fx.Assert(valueIndex < values.Length, "Not enough values to bind"); if (this.EndsWithSlash) { path.AppendFormat("{0}/", values[valueIndex++]); } else { path.Append(values[valueIndex++]); } } public override bool IsEquivalentTo(UriTemplatePathSegment other, bool ignoreTrailingSlash) { if (other == null) { Fx.Assert("why would we ever call this?"); return false; } if (!ignoreTrailingSlash && (this.EndsWithSlash != other.EndsWithSlash)) { return false; } return (other.Nature == UriTemplatePartType.Variable); } public override bool IsMatch(UriTemplateLiteralPathSegment segment, bool ignoreTrailingSlash) { if (!ignoreTrailingSlash && (this.EndsWithSlash != segment.EndsWithSlash)) { return false; } return (!segment.IsNullOrEmpty()); } public override void Lookup(string segment, NameValueCollection boundParameters) { Fx.Assert(!string.IsNullOrEmpty(segment), "How can that be? Lookup is expected to be called after IsMatch"); boundParameters.Add(this.varName, segment); } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- Rule.cs
- DataFormats.cs
- InsufficientExecutionStackException.cs
- ResolvedKeyFrameEntry.cs
- NavigationEventArgs.cs
- Crc32.cs
- WorkflowInspectionServices.cs
- WinFormsComponentEditor.cs
- KeyProperty.cs
- DbProviderConfigurationHandler.cs
- XmlSchemaType.cs
- WebEncodingValidator.cs
- BufferedGraphicsContext.cs
- LocationUpdates.cs
- DataGridViewSelectedCellCollection.cs
- ArgumentNullException.cs
- TextRenderer.cs
- XmlWellformedWriter.cs
- XsltLibrary.cs
- CommunicationObjectManager.cs
- XmlnsPrefixAttribute.cs
- DependencyPropertyAttribute.cs
- DataGridViewRowErrorTextNeededEventArgs.cs
- XPathDocumentIterator.cs
- LocatorPartList.cs
- ConnectionConsumerAttribute.cs
- DBProviderConfigurationHandler.cs
- InkCanvasSelectionAdorner.cs
- GenerateTemporaryTargetAssembly.cs
- SafeEventHandle.cs
- FrugalMap.cs
- PagesSection.cs
- Encoding.cs
- ASCIIEncoding.cs
- ChannelServices.cs
- AutomationFocusChangedEventArgs.cs
- TimelineGroup.cs
- SafeTokenHandle.cs
- TraceLog.cs
- RawStylusInputReport.cs
- DrawingDrawingContext.cs
- EntitySqlException.cs
- AffineTransform3D.cs
- LinearQuaternionKeyFrame.cs
- HttpRequestCacheValidator.cs
- IERequestCache.cs
- storepermissionattribute.cs
- PersonalizationEntry.cs
- GridItemPattern.cs
- TaskHelper.cs
- SQLSingleStorage.cs
- BindableAttribute.cs
- MatrixConverter.cs
- CompiledQueryCacheKey.cs
- UniqueConstraint.cs
- AnnotationComponentManager.cs
- ParsedAttributeCollection.cs
- WebHttpEndpointElement.cs
- ChtmlCalendarAdapter.cs
- CryptoHelper.cs
- UpdateDelegates.Generated.cs
- TargetInvocationException.cs
- ToolStripHighContrastRenderer.cs
- PlatformNotSupportedException.cs
- PeerReferralPolicy.cs
- ReferenceList.cs
- TypeBuilderInstantiation.cs
- PathGradientBrush.cs
- Types.cs
- SrgsGrammar.cs
- CodeTypeReferenceCollection.cs
- DBDataPermissionAttribute.cs
- UIPermission.cs
- AsyncCodeActivity.cs
- RectAnimationClockResource.cs
- InternalRelationshipCollection.cs
- StaticDataManager.cs
- RolePrincipal.cs
- QueryableFilterUserControl.cs
- FontStretchConverter.cs
- DetailsViewInsertEventArgs.cs
- ZoneIdentityPermission.cs
- PackageProperties.cs
- DictationGrammar.cs
- MouseEvent.cs
- NativeMethods.cs
- DataGridViewRowEventArgs.cs
- Interlocked.cs
- RTLAwareMessageBox.cs
- ListViewInsertionMark.cs
- SqlUserDefinedTypeAttribute.cs
- DesignTimeTemplateParser.cs
- TextWriter.cs
- CqlBlock.cs
- DataBoundControl.cs
- CheckPair.cs
- EdmError.cs
- ColumnHeader.cs
- RoleManagerSection.cs
- DBNull.cs