1 namespace System.Web.Routing { 2 using System.Collections.Generic; 3 using System.Linq; 4 5 // Represents a segment of a URL that is not a separator. It contains subsegments such as literals and parameters. 6 internal sealed class ContentPathSegment : PathSegment { ContentPathSegment(IList<PathSubsegment> subsegments)7 public ContentPathSegment(IList<PathSubsegment> subsegments) { 8 Subsegments = subsegments; 9 } 10 11 public bool IsCatchAll { 12 get { 13 // 14 return Subsegments.Any<PathSubsegment>(seg => (seg is ParameterSubsegment) && (((ParameterSubsegment)seg).IsCatchAll)); 15 } 16 } 17 18 public IList<PathSubsegment> Subsegments { 19 get; 20 private set; 21 } 22 23 #if ROUTE_DEBUGGING 24 public override string LiteralText { 25 get { 26 List<string> s = new List<string>(); 27 foreach (PathSubsegment subsegment in Subsegments) { 28 s.Add(subsegment.LiteralText); 29 } 30 return String.Join(String.Empty, s.ToArray()); 31 } 32 } 33 ToString()34 public override string ToString() { 35 List<string> s = new List<string>(); 36 foreach (PathSubsegment subsegment in Subsegments) { 37 s.Add(subsegment.ToString()); 38 } 39 return "[ " + String.Join(", ", s.ToArray()) + " ]"; 40 } 41 #endif 42 } 43 } 44