结构定义函数
/* * 由SharpDevelop创建。 * 用户: Administrator * 日期: 2018/10/20 * 时间: 21:07 * * 要改变这种模板请点击 工具|选项|代码编写|编辑标准头文件 */ using System; namespace C结构函数 { struct CustomerName { public string firtName; public string lastName; public string Getname() { return firtName+" "+lastName; } } struct Vector3{ public float x; public float y; public float z; public Double Distance(){ return Math.Sqrt (x*x+y*y+z*z); } } class Program{ public static void Main(string[] args) { Vector3 myVector3; myVector3.x=3; myVector3.y=3; myVector3.z=3; Console.WriteLine(myVector3.Distance()); // TODO: Implement Functionality Here Console.Write("Press any key to continue . . . "); Console.ReadKey(true); } } }