1 我想封装类似c中.h文件中的结构体 请问是用c#中结构体 还是属性??两者的优劣性?
 2 想问大家在开发项目的时候 sql语句是直接写到字符串中 还是封装成了类中的函数???

解决方案 »

  1.   

    1.  c#中用结构体,不过要写成类似于下面的形式。
    [StructLayout(LayoutKind.Sequential, Pack = 1)] 
    public struct Query_Res 
    {
    public ulong mt_total_msg; //从ICP接收的信息总数
    public ulong mt_total_user; //从ICP接收的用户总数
    public ulong mt_succ; //成功转发数量
    public ulong mt_wait; //待转发数量
    public ulong mt_fail; //转发失败数量
    public ulong mo_succ; //向ICP成功送达数量
    public ulong mo_wait; //向ICP待送达数量
    public ulong mo_fail; //向ICP送达失败数量
    }2.  sql语句要看具体项目了。不过你应该封一个数据库访问层
      

  2.   

    Tony_lau111082(刘寓) [StructLayout(LayoutKind.Sequential, Pack = 1)]  是必须的吗?
    能解释一下吗?