您的位置:知识库 » .NET技术

类和结构体解析

作者: VisualStudio  来源: 博客园  发布时间: 2008-10-14 23:43  阅读: 6627 次  推荐: 0   原文链接   [收藏]  

系列文章导航:

创建一个示例和WebMethod特性解析

WebService特性和数组类型解析

类和结构体解析

利用YAHOO公开API做天气预报Web服务

Webservice 的设计和模式

Remoting和Webservice的区别


  现在开始学习Web服务,写下自己学习过程中的一些感受,拿出来与大家分享,欢迎批评指正。希望能给跟我一样初学Web服务的朋友一些帮助。

  今天学习了Web服务的类和结构体一节,晚上写下自己所理解的内容,跟大家一起分享了。请批评指正。

Web服务能够把用户定义的类和结构体作为参数或者返回值,但是这里需要记住一些规则,是关于那些类变量可以在Web服务中使用的:

(1)所有类变量必须是基本数据类型或者基本数据类型的数组。

(2)所有类变量必须是公开的或者有一个公开时限的get和set访问器的属性。

为了理解在Web服务中使用类,我做了个实验。创建Web服务,在其中添加一个数组。

        //构造并填充info数组
        string[,] strStuInfo ={
                            
{"200511020120","贰零零五届","人文法律学院","社会工作","(1)班","贺无悔","1"},
                            
{"200511020121","贰零零五届","人文法律学院","社会工作","(1)班","贺梁需","2"},
                            
{"200511010122","贰零零五届","人文法律学院","法律专业","(1)班","贺陆磊","3"},
                            
{"200511010220","贰零零五届","人文法律学院","法律专业","(2)班","贺白灵","4"},
                            
{"200511010221","贰零零五届","人文法律学院","法律专业","(2)班","李剑付","5"},
                            
{"200511020222","贰零零五届","人文法律学院","社会工作","(2)班","李敬意","6"},
                            
{"200511100120","贰零零五届","化工生物学院","生物制药","(1)班","李黄兴","7"},
                            
{"200511100221","贰零零五届","化工生物学院","生物制药","(2)班","李蕾蕾","8"},
                            
{"200511100322","贰零零五届","化工生物学院","生物制药","(3)班","杜白冰","9"},
                            
{"200611120120","贰零零六届","化工生物学院","发酵工程","(1)班","杜书并","10"},
                            
{"200611120121","贰零零六届","化工生物学院","发酵工程","(1)班","杜小鱼","11"},
                            
{"200611120421","贰零零六届","化工生物学院","发酵工程","(4)班","杜声声","12"},
                         }
;

 

0
0

.NET技术热门文章

    .NET技术最新文章

      最新新闻

        热门新闻