私は WCF について学んでいて、単純な WCF の例に関するこの記事を見つけました。
次のコード (上記の記事から) ではSystem.ServiceModel.Dispatcher.ChannelDispatcher
、 foreach ループ内に ? があるのに、なぜ を完全修飾する必要があるのusing System.ServiceModel;
ですか? whileServiceHost
が機能するために完全に修飾する必要はなく、 と同じ名前空間からのものDispatcher
です。
System.ServiceModel
ループ内でfromを削除するとSystem.ServiceModel.Dispatcher.ChannelDispatcher
、コードはコンパイルされません。
using System;
using System.ServiceModel;
namespace ConsoleHost
{
class Program
{
static void Main(string[] args)
{
Type serviceType = typeof(EmailService.EmailValidator);
Uri serviceUri = new Uri("http://localhost:8080/");
ServiceHost host = new ServiceHost(serviceType, serviceUri);
host.Open();
foreach (System.ServiceModel.Dispatcher.ChannelDispatcher dispatcher in host.ChannelDispatchers)
{
Console.WriteLine("\t{0}, {1}", dispatcher.Listener.Uri.ToString(), dispatcher.BindingName);
}
}
}
}