[C#] C#中使用结构体struct范例 →→→→→进入此内容的聊天室

来自 , 2020-11-13, 写在 C#, 查看 171 次.
URL http://www.code666.cn/view/db182d25
  1. using System;
  2.  
  3. struct Person
  4. {
  5. public string name;
  6. public int age;
  7. public double height;
  8. }
  9.  
  10. class TestStructureType
  11. {
  12. public static void Main ()
  13. {
  14. Person p;
  15. p.name ="mani";
  16. p.age = 24;
  17. p.height = 5.5;
  18. Console.WriteLine("Person Name: " + p.name);
  19. Console.WriteLine("Person Age: " + p.age );
  20. Console.WriteLine("Height: "+ p.height);
  21. }
  22. }
  23. //csharp/7499

回复 "C#中使用结构体struct范例"

这儿你可以回复上面这条便签

captcha