Fragment Property
Collapse the table of content
Expand the table of content

UriBuilder.Fragment Property

Gets or sets the fragment portion of the URI.

[Visual Basic]
Public Property Fragment As String
public string Fragment {get; set;}
public: __property String* get_Fragment();
public: __property void set_Fragment(String*);
public function get Fragment() : String;
public function set Fragment(String);

Property Value

The fragment portion of the URI. The fragment identifier ("#") is added to the beginning of the fragment.


The Fragment property contains any text following a fragment marker (#) in the URI, including the marker itself. When setting the Fragment property, the fragment marker is added to its value. Setting the Fragment property to any value, including a null reference (Nothing in Visual Basic), clears the Query property. Setting the Fragment property to a null reference (Nothing) or to String.Empty clears the property.


[Visual Basic, C#, C++] The following example creates the URI "".

[Visual Basic] 
Dim uBuild As New UriBuilder("")
uBuild.Path = "index.htm"
uBuild.Fragment = "main"
Dim myUri As Uri = uBuild.Uri

UriBuilder uBuild = new UriBuilder("");
uBuild.Path = "index.htm";
uBuild.Fragment = "main";

Uri myUri = uBuild.Uri;

UriBuilder* uBuild = new UriBuilder(S"");
uBuild->Path = S"index.htm";
uBuild->Fragment = S"main";

Uri* myUri = uBuild->Uri;

[JScript] No example is available for JScript. To view a Visual Basic, C#, or C++ example, click the Language Filter button Language Filter in the upper-left corner of the page.


Platforms: Windows 98, Windows NT 4.0, Windows Millennium Edition, Windows 2000, Windows XP Home Edition, Windows XP Professional, Windows Server 2003 family, Common Language Infrastructure (CLI) Standard

See Also

UriBuilder Class | UriBuilder Members | System Namespace

© 2016 Microsoft