Skip to content

Commit b525f0a

Browse files
authored
Make the example more interesting and show what each property returns. (#4388)
1 parent 23877ab commit b525f0a

File tree

1 file changed

+43
-3
lines changed
  • samples/snippets/csharp/VS_Snippets_Remoting/Classic Uri Example/CS

1 file changed

+43
-3
lines changed

samples/snippets/csharp/VS_Snippets_Remoting/Classic Uri Example/CS/source.cs

Lines changed: 43 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,50 @@ public class Form1: Form
77
{
88
protected void Method()
99
{
10-
// <Snippet1>
11-
Uri siteUri = new Uri("http://www.contoso.com/");
10+
Uri uri = new Uri("https://user:[email protected]:80/Home/Index.htm?q1=v1&q2=v2#FragmentName");
11+
Console.WriteLine("AbsolutePath: {0}", uri.AbsolutePath);
12+
Console.WriteLine("AbsoluteUri: {0}", uri.AbsoluteUri);
13+
Console.WriteLine("DnsSafeHost: {0}", uri.DnsSafeHost);
14+
Console.WriteLine("Fragment: {0}", uri.Fragment);
15+
Console.WriteLine("Host: {0}", uri.Host);
16+
Console.WriteLine("HostNameType: {0}", uri.HostNameType);
17+
Console.WriteLine("IdnHost: {0}", uri.IdnHost);
18+
Console.WriteLine("IsAbsoluteUri: {0}", uri.IsAbsoluteUri);
19+
Console.WriteLine("IsDefaultPort: {0}", uri.IsDefaultPort);
20+
Console.WriteLine("IsFile: {0}", uri.IsFile);
21+
Console.WriteLine("IsLoopback: {0}", uri.IsLoopback);
22+
Console.WriteLine("IsUnc: {0}", uri.IsUnc);
23+
Console.WriteLine("LocalPath: {0}", uri.LocalPath);
24+
Console.WriteLine("OriginalString: {0}", uri.OriginalString);
25+
Console.WriteLine("PathAndQuery: {0}", uri.PathAndQuery);
26+
Console.WriteLine("Port: {0}", uri.Port);
27+
Console.WriteLine("Query: {0}", uri.Query);
28+
Console.WriteLine("Scheme: {0}", uri.Scheme);
29+
Console.WriteLine("Segments: {0}", string.Join(", ", uri.Segments));
30+
Console.WriteLine("UserEscaped: {0}", uri.UserEscaped);
31+
Console.WriteLine("UserInfo: {0}", uri.UserInfo);
1232

13-
WebRequest wr = WebRequest.Create(siteUri);
33+
// AbsolutePath: /Home/Index.htm
34+
// AbsoluteUri: https://user:[email protected]:80/Home/Index.htm?q1=v1&q2=v2#FragmentName
35+
// DnsSafeHost: www.contoso.com
36+
// Fragment: #FragmentName
37+
// Host: www.contoso.com
38+
// HostNameType: Dns
39+
// IdnHost: www.contoso.com
40+
// IsAbsoluteUri: True
41+
// IsDefaultPort: False
42+
// IsFile: False
43+
// IsLoopback: False
44+
// IsUnc: False
45+
// LocalPath: /Home/Index.htm
46+
// OriginalString: https://user:[email protected]:80/Home/Index.htm?q1=v1&q2=v2#FragmentName
47+
// PathAndQuery: /Home/Index.htm?q1=v1&q2=v2
48+
// Port: 80
49+
// Query: ?q1=v1&q2=v2
50+
// Scheme: https
51+
// Segments: /, Home/, Index.htm
52+
// UserEscaped: False
53+
// UserInfo: user:password
1454

1555
// </Snippet1>
1656
}

0 commit comments

Comments
 (0)