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
- ElementUtil.cs
- DeviceContexts.cs
- BamlBinaryReader.cs
- PreviewKeyDownEventArgs.cs
- _SslStream.cs
- RelatedPropertyManager.cs
- ShaderEffect.cs
- IgnoreSection.cs
- SetterBaseCollection.cs
- FolderBrowserDialogDesigner.cs
- FieldAccessException.cs
- TableLayoutPanelCellPosition.cs
- ObservableDictionary.cs
- UnmanagedBitmapWrapper.cs
- FieldToken.cs
- Material.cs
- WebBaseEventKeyComparer.cs
- MeasureItemEvent.cs
- ValueSerializerAttribute.cs
- CodeDirectoryCompiler.cs
- QuaternionRotation3D.cs
- FileStream.cs
- SystemIPGlobalStatistics.cs
- StateBag.cs
- ValidatedControlConverter.cs
- TreeNodeCollectionEditorDialog.cs
- Bits.cs
- HttpPostedFile.cs
- SiteMapDesignerDataSourceView.cs
- StoreItemCollection.cs
- ResolvedKeyFrameEntry.cs
- XmlILStorageConverter.cs
- CacheHelper.cs
- SpotLight.cs
- ManipulationCompletedEventArgs.cs
- basecomparevalidator.cs
- COM2EnumConverter.cs
- StreamInfo.cs
- PathFigure.cs
- Point.cs
- UInt16Storage.cs
- CorePropertiesFilter.cs
- SemanticResolver.cs
- SystemIPInterfaceStatistics.cs
- FlowLayoutPanel.cs
- ProjectionPruner.cs
- EventItfInfo.cs
- FlowLayoutPanelDesigner.cs
- ScriptingScriptResourceHandlerSection.cs
- TokenizerHelper.cs
- LayoutSettings.cs
- CultureInfo.cs
- ZipIOCentralDirectoryFileHeader.cs
- CodeTypeDeclarationCollection.cs
- UrlMappingsSection.cs
- DeviceContexts.cs
- ConsumerConnectionPoint.cs
- _emptywebproxy.cs
- CodeSpit.cs
- SolidColorBrush.cs
- StreamUpdate.cs
- NewArray.cs
- FormattedText.cs
- ImageMap.cs
- IProvider.cs
- MasterPageCodeDomTreeGenerator.cs
- SystemWebCachingSectionGroup.cs
- Fx.cs
- MaskInputRejectedEventArgs.cs
- DelegatingHeader.cs
- StyleSheet.cs
- ViewGenResults.cs
- AlphabeticalEnumConverter.cs
- DataGridViewRowStateChangedEventArgs.cs
- ListViewGroupCollectionEditor.cs
- SqlDataSourceCommandEventArgs.cs
- Pair.cs
- InheritanceContextHelper.cs
- AssemblyBuilder.cs
- PasswordBoxAutomationPeer.cs
- RetrieveVirtualItemEventArgs.cs
- RichTextBox.cs
- FileLogRecordHeader.cs
- CustomPopupPlacement.cs
- CharacterBufferReference.cs
- DataGridViewRow.cs
- LinkedResourceCollection.cs
- DataServiceClientException.cs
- ZeroOpNode.cs
- VarInfo.cs
- ObjectDataSourceFilteringEventArgs.cs
- SqlDataSourceView.cs
- UnaryNode.cs
- Msec.cs
- TemplateBuilder.cs
- SafeSystemMetrics.cs
- MgmtConfigurationRecord.cs
- RelationshipEndMember.cs
- SiteMapProvider.cs
- EntityUtil.cs