本文整理汇总了C#中System.Web.Services.Description.ImportCollection类的典型用法代码示例。如果您正苦于以下问题:C# ImportCollection类的具体用法?C# ImportCollection怎么用?C# ImportCollection使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ImportCollection类属于System.Web.Services.Description命名空间,在下文中一共展示了ImportCollection类的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: Main
//引入命名空间
using System;
using System.Web.Services.Description;
using System.Xml;
class ServiceDescription_ImportCollection
{
public static void Main()
{
ServiceDescription myServiceDescription = ServiceDescription.Read("StockQuoteService_cs.wsdl");
Console.WriteLine(" ImportCollection Sample ");
// Get Import Collection.
ImportCollection myImportCollection = myServiceDescription.Imports;
Console.WriteLine("Total Imports in the document = " + myServiceDescription.Imports.Count);
// Print 'Import' properties to console.
for(int i =0; i < myImportCollection.Count; ++i)
Console.WriteLine("\tImport Namespace :{0} Import Location :{1} "
,myImportCollection[i].Namespace
,myImportCollection[i].Location);
Import[] myImports = new Import[myServiceDescription.Imports.Count];
// Copy 'ImportCollection' to an array.
myServiceDescription.Imports.CopyTo(myImports,0);
Console.WriteLine("Imports that are copied to Importarray ...");
for(int i=0;i < myImports.Length; ++i)
Console.WriteLine("\tImport Namespace :{0} Import Location :{1} "
,myImports[i].Namespace
,myImports[i].Location);
// Get Import by Index.
Import myImport = myServiceDescription.Imports[myServiceDescription.Imports.Count-1];
Console.WriteLine("Import by Index...");
if (myImportCollection.Contains(myImport))
{
Console.WriteLine("Import Namespace '"
+ myImport.Namespace + "' is found in 'ImportCollection'.");
Console.WriteLine("Index of '" + myImport.Namespace + "' in 'ImportCollection' = "
+ myImportCollection.IndexOf(myImport));
Console.WriteLine("Deleting Import from 'ImportCollection'...");
myImportCollection.Remove(myImport);
if(myImportCollection.IndexOf(myImport) == -1)
Console.WriteLine("Import is successfully removed from Import Collection.");
}
}
}
开发者ID:.NET开发者,项目名称:System.Web.Services.Description,代码行数:43,代码来源:ImportCollection
注:本文中的System.Web.Services.Description.ImportCollection类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论