static void insert()
        {
            string m;
            do
            {               
                student[] s = new student[1] { new student() }; 
                Console.WriteLine("你的姓名是: ");
                s[0].Name = Console.ReadLine();
                  ..............
                 ................
                m = Console.ReadLine();
            } while (m != "y"||n !="Y");
        }
        static void cout()
           {
               foreach(...........)                 {
                     { .............
                        ............}
            }
我在main()中定义了两个结构体的类型 insert()和cout()  我在用insert()中进行数据输入后,如何有在cout()中进行数据的显示呢?
或是如何定义才能进行显示?跪球各位高手,我将如何才能解决这个问题! 
或还有什么更好的方法能够实现此功能! 
     定当万分感激!!!!!!! 

解决方案 »

  1.   

    1 结构体是值类型,直接赋值,像 int i=0;
    2 foreach只能遍历实现了IEnumerable 和 GetEnumeretor接口的对象,可能有字母拼写问题,^_^
    3 其他就跟C语言差不多使用
      

  2.   

    struct
    static……结构体是轻型类,虽然是值类型,使用同类的方法
    就像string,虽然是引用类型,但使用同值类型static方法和属性的使用不需要类进行实例化后才能用
      

  3.   

    insert()你说的这两个冬冬是对象class不是结构体
      

  4.   


    namespace XMLSize
    {
    public struct strRestric 
    {
    public string msgPage;
    public string msgPrompt;
    public int size;
    } public class XmlRestrict
    {
    public static strRestric res;

    public XmlRestrict()
    {
    res.msgPage="";
    res.msgPrompt="";
    res.size=0;
    }
            public static object insert(strRestric res)
    {
    res.msgPage=value.ToString();
    res.msgPrompt=value.ToString();
    res.size=value.ToString();
    return res;
    }
    public static object count(strRestric res)
    {
       string s=res.msgPage.ToString();
    }
             }
    }