当前位置: 首页 > 图文教程 > 网络编程 > ASP.NET > C#中结构与类的区别

ASP.NET
ewebeditor在.net的使用方法
Server.Transfer,Response.Redirect的区别
ASP.NET2.0+SQL Server2005构建多层应用
ASP.NET 2.0 中收集的小功能点(转)
ASP.Net全局变量的设置和读取方法
数据库开发总结(ADO.NET小结)
ASP.net(c#)打造24小时天气预报及实时天气
发布WEB站点时出现Server Application Unavailable
在asp.net中实现datagrid checkbox 全选的方法
ASP.NET 2.0 URL映射技巧
ConfiguraionSource节点及多个配置文件的应用
SqlConnection.ConnectionString相关关键字
如何在WebForm中使用javascript防止连打(双击)
看到本质而不是现象--解决ASP.NET CS0016的问题
学会区分Visual Studio 2005,Visual Studio 2005 Team System和MSDN Premium 订阅的各个版本
ASP.NET 入门的五个步骤
ASP.NET 高性能分页代码
动态ItemTemplate的实现(译) - item,template
遍历Hashtable 的几种方法
通过VS中的数据源选择对话框简单实现数据库连接配置

ASP.NET 中的 C#中结构与类的区别


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-11-03   浏览: 201 ::
收藏到网摘: n/a

本文目录
  类与结构的实例比较
  类与结构的差别
  如何选择结构还是类
  一.类与结构的示例比较:
  结构示例:

  public struct Person
  {
  string Name;
  int height;
  int weight
  public bool overWeight()
  {
  //implement something
  }
  }
  类示例:
  public class TestTime
  {
  int hours;
  int minutes;
  int seconds;
  public void passtime()
  {
  //implementation of behavior
  }
  }
  调用过程:
  public class Test
  {
  public static ovid Main
  {
  Person Myperson=new Person //声明结构
  TestTime Mytime=New TestTime //声明类
  }
  }
 〈由厦娴睦