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
- RadioButton.cs
- SubMenuStyleCollection.cs
- WebSysDefaultValueAttribute.cs
- InvokeHandlers.cs
- BaseAsyncResult.cs
- Ipv6Element.cs
- CryptoConfig.cs
- HwndHostAutomationPeer.cs
- SafeBitVector32.cs
- CaseCqlBlock.cs
- BooleanConverter.cs
- RequestStatusBarUpdateEventArgs.cs
- SplitterEvent.cs
- VirtualizedItemPattern.cs
- BindUriHelper.cs
- RefreshEventArgs.cs
- NegotiationTokenAuthenticatorState.cs
- ContentIterators.cs
- ScrollEventArgs.cs
- AddInAttribute.cs
- ColumnHeader.cs
- CodeDomConfigurationHandler.cs
- PropertiesTab.cs
- TableAdapterManagerNameHandler.cs
- WorkflowFileItem.cs
- QueryOperator.cs
- Parameter.cs
- TimeSpanConverter.cs
- PartitionedDataSource.cs
- GridViewAutomationPeer.cs
- OdbcException.cs
- Drawing.cs
- Stylus.cs
- ListItemConverter.cs
- DuplicateWaitObjectException.cs
- PartialTrustHelpers.cs
- RichTextBoxConstants.cs
- NonBatchDirectoryCompiler.cs
- PrivilegedConfigurationManager.cs
- CurrentTimeZone.cs
- PriorityRange.cs
- CompilerGeneratedAttribute.cs
- OleDbFactory.cs
- httpstaticobjectscollection.cs
- CryptoHandle.cs
- SequenceNumber.cs
- Control.cs
- ListViewGroup.cs
- XmlSchemaAttributeGroup.cs
- TCEAdapterGenerator.cs
- VisualBrush.cs
- InfiniteIntConverter.cs
- PriorityBindingExpression.cs
- UniqueConstraint.cs
- JumpList.cs
- ContentFilePart.cs
- ModuleBuilderData.cs
- Boolean.cs
- Size.cs
- StringSorter.cs
- SmiRequestExecutor.cs
- PassportAuthenticationModule.cs
- ProjectedWrapper.cs
- DataRow.cs
- HttpContextServiceHost.cs
- NativeMethods.cs
- BuildProvider.cs
- TextTreeUndoUnit.cs
- SessionStateContainer.cs
- HttpCacheParams.cs
- RepeaterItem.cs
- StyleSheetRefUrlEditor.cs
- HttpListener.cs
- Root.cs
- ClockGroup.cs
- RealizationDrawingContextWalker.cs
- TextWriter.cs
- AppSettingsExpressionBuilder.cs
- Convert.cs
- GridViewRowEventArgs.cs
- SqlMethodAttribute.cs
- ByteStream.cs
- RegexCode.cs
- UInt32.cs
- XmlWriterTraceListener.cs
- xml.cs
- EllipseGeometry.cs
- EncodingNLS.cs
- CodePrimitiveExpression.cs
- RuntimeArgumentHandle.cs
- DataObject.cs
- DbParameterHelper.cs
- SchemaElementLookUpTableEnumerator.cs
- DiffuseMaterial.cs
- Error.cs
- EventProxy.cs
- DataViewListener.cs
- CompilerCollection.cs
- ComplexTypeEmitter.cs
- LineSegment.cs