Csharp/C Sharp by API/System.Net/Uri — различия между версиями
Admin (обсуждение | вклад) м (1 версия) |
|
(нет различий)
|
Версия 15:31, 26 мая 2010
Содержание
new Uri(String uri)
using System;
using System.Net;
class MainClass {
public static void Main() {
Uri sample = new Uri("http://www.yoursite.ru/somefile.txt?SomeQuery");
Console.WriteLine("Host: " + sample.Host);
Console.WriteLine("Port: " + sample.Port);
Console.WriteLine("Scheme: " + sample.Scheme);
Console.WriteLine("Local Path: " + sample.LocalPath);
Console.WriteLine("Query: " + sample.Query);
Console.WriteLine("Path and query: " + sample.PathAndQuery);
}
}
Uri.Host
using System;
using System.Net;
public class UriDemo {
public static void Main() {
Uri sample = new Uri("http://MySite.ru/somefile.txt?SomeQuery");
Console.WriteLine("Host: " + sample.Host);
Console.WriteLine("Port: " + sample.Port);
Console.WriteLine("Scheme: " + sample.Scheme);
Console.WriteLine("Local Path: " + sample.LocalPath);
Console.WriteLine("Query: " + sample.Query);
Console.WriteLine("Path and queury: " + sample.PathAndQuery);
}
}
Uri.LocalPath
using System;
using System.Net;
public class UriDemo {
public static void Main() {
Uri sample = new Uri("http://MySite.ru/somefile.txt?SomeQuery");
Console.WriteLine("Host: " + sample.Host);
Console.WriteLine("Port: " + sample.Port);
Console.WriteLine("Scheme: " + sample.Scheme);
Console.WriteLine("Local Path: " + sample.LocalPath);
Console.WriteLine("Query: " + sample.Query);
Console.WriteLine("Path and queury: " + sample.PathAndQuery);
}
}
Uri.PathAndQuery
using System;
using System.Net;
class MainClass {
public static void Main() {
Uri sample = new Uri("http://www.yoursite.ru/somefile.txt?SomeQuery");
Console.WriteLine("Host: " + sample.Host);
Console.WriteLine("Port: " + sample.Port);
Console.WriteLine("Scheme: " + sample.Scheme);
Console.WriteLine("Local Path: " + sample.LocalPath);
Console.WriteLine("Query: " + sample.Query);
Console.WriteLine("Path and query: " + sample.PathAndQuery);
}
}
Uri.Port
using System;
using System.Net;
public class UriDemo {
public static void Main() {
Uri sample = new Uri("http://MySite.ru/somefile.txt?SomeQuery");
Console.WriteLine("Host: " + sample.Host);
Console.WriteLine("Port: " + sample.Port);
Console.WriteLine("Scheme: " + sample.Scheme);
Console.WriteLine("Local Path: " + sample.LocalPath);
Console.WriteLine("Query: " + sample.Query);
Console.WriteLine("Path and queury: " + sample.PathAndQuery);
}
}
Uri.Query
using System;
using System.Net;
public class UriDemo {
public static void Main() {
Uri sample = new Uri("http://MySite.ru/somefile.txt?SomeQuery");
Console.WriteLine("Host: " + sample.Host);
Console.WriteLine("Port: " + sample.Port);
Console.WriteLine("Scheme: " + sample.Scheme);
Console.WriteLine("Local Path: " + sample.LocalPath);
Console.WriteLine("Query: " + sample.Query);
Console.WriteLine("Path and queury: " + sample.PathAndQuery);
}
}
Uri.Scheme
using System;
using System.Net;
public class UriDemo {
public static void Main() {
Uri sample = new Uri("http://MySite.ru/somefile.txt?SomeQuery");
Console.WriteLine("Host: " + sample.Host);
Console.WriteLine("Port: " + sample.Port);
Console.WriteLine("Scheme: " + sample.Scheme);
Console.WriteLine("Local Path: " + sample.LocalPath);
Console.WriteLine("Query: " + sample.Query);
Console.WriteLine("Path and queury: " + sample.PathAndQuery);
}
}