c#中如何访问结构类型中的结构类型的成员?

using System; using System.Collections.Generic; using System.Text; namespace ConsoleApplication3 { class Program { public struct student { public string name; public int ID; public struct address { public string school; public string name; } } static void Main(string[] args) { student s1; Console.WriteLine(); } } } 如上,要是想访问student里的address的school应该如何访问?

慕尼黑8549860
浏览 609回答 3
3回答

慕沐林林

public struct student { public string name; public int ID; public struct address { public string school; public string name; } } 有问题 改成 public struct student { public string name; public int ID; public address add; //这里少了句 public struct address { public string school; public string name; } }
打开App,查看更多内容
随时随地看视频慕课网APP