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
- LineInfo.cs
- ComboBoxAutomationPeer.cs
- StyleXamlParser.cs
- XmlSchemaRedefine.cs
- TemplateAction.cs
- SQLDateTimeStorage.cs
- XmlSerializationReader.cs
- MeasurementDCInfo.cs
- NullRuntimeConfig.cs
- TextEvent.cs
- ImageDrawing.cs
- IntegerCollectionEditor.cs
- ConfigurationStrings.cs
- UnlockInstanceCommand.cs
- FontStyles.cs
- NativeMethods.cs
- ControlValuePropertyAttribute.cs
- GroupBox.cs
- VersionValidator.cs
- PasswordRecovery.cs
- EmptyElement.cs
- MemberCollection.cs
- MatrixKeyFrameCollection.cs
- UnconditionalPolicy.cs
- AssemblyContextControlItem.cs
- DocumentApplicationJournalEntry.cs
- GetBrowserTokenRequest.cs
- AnimationException.cs
- ArcSegment.cs
- CollectionType.cs
- ReadContentAsBinaryHelper.cs
- Encoder.cs
- ActivityIdHeader.cs
- ListViewCancelEventArgs.cs
- InputLanguageProfileNotifySink.cs
- CompositionDesigner.cs
- ListViewHitTestInfo.cs
- SafeViewOfFileHandle.cs
- DataControlFieldCollection.cs
- XmlSignatureProperties.cs
- AuthenticationModulesSection.cs
- LogExtent.cs
- CapabilitiesRule.cs
- ArrayTypeMismatchException.cs
- OrderByQueryOptionExpression.cs
- PropertyInfoSet.cs
- TrackingProfileManager.cs
- ReadOnlyTernaryTree.cs
- XNodeSchemaApplier.cs
- COM2IProvidePropertyBuilderHandler.cs
- TextServicesCompartment.cs
- LogExtent.cs
- WebPartDisplayModeCancelEventArgs.cs
- HitTestFilterBehavior.cs
- TraceXPathNavigator.cs
- HybridDictionary.cs
- MtomMessageEncoder.cs
- RtfToXamlLexer.cs
- StandardCommands.cs
- Normalization.cs
- StandardCommands.cs
- TextTrailingWordEllipsis.cs
- TypeAccessException.cs
- Certificate.cs
- DragDeltaEventArgs.cs
- MSHTMLHost.cs
- FontCollection.cs
- DataMisalignedException.cs
- ToolStripContainer.cs
- TargetConverter.cs
- BindingOperations.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- ProgressBar.cs
- EditorAttribute.cs
- HtmlControlPersistable.cs
- WebPartVerbCollection.cs
- ParenthesizePropertyNameAttribute.cs
- PocoEntityKeyStrategy.cs
- DataFormats.cs
- CodeDefaultValueExpression.cs
- OrderedDictionaryStateHelper.cs
- AssemblyCacheEntry.cs
- DataGridRow.cs
- TimerEventSubscriptionCollection.cs
- FixedSOMImage.cs
- BindToObject.cs
- ObjectContextServiceProvider.cs
- CheckBox.cs
- FileChangesMonitor.cs
- ProgressBarHighlightConverter.cs
- SmiMetaDataProperty.cs
- MenuItem.cs
- CursorInteropHelper.cs
- DebugManager.cs
- MergeFilterQuery.cs
- FrameworkContentElement.cs
- SecureStringHasher.cs
- QueryContinueDragEvent.cs
- InputQueue.cs
- HtmlMeta.cs