C# Uri PathAndQuery

Description

Uri PathAndQuery gets the AbsolutePath and Query properties separated by a question mark (?).

Syntax

Uri.PathAndQuery has the following syntax.


public string PathAndQuery { get; }

Example

The following example writes the URI path (/catalog/shownew.htm) and query (date=today) information to the console.


//from   w w  w.ja va2s  . c om
using System;
public class MainClass{
  public static void Main(String[] argv){  
    Uri baseUri = new Uri("http://www.java2s.com/");
    Uri myUri = new Uri(baseUri, "name/shownew.htm?date=today");
    
    Console.WriteLine(myUri.PathAndQuery);

  }
}
    

The code above generates the following result.





















Home »
  C# Tutorial »
    System »




Array
BitConverter
Boolean
Byte
Char
Console
ConsoleKeyInfo
Convert
DateTime
DateTimeOffset
Decimal
Double
Enum
Environment
Exception
Guid
Int16
Int32
Int64
Math
OperatingSystem
Random
SByte
Single
String
StringComparer
TimeSpan
TimeZone
TimeZoneInfo
Tuple
Tuple
Tuple
Type
UInt16
UInt32
UInt64
Uri
Version