1.值语义和引用语义 示例: package main import "fmt" type Person struct { name string //名字 sex byte //性别, 字符类型 age int //年龄 } //修改成员变量的值 //接收者为普通变量,非指针,值语义,一份拷贝 func (p Person) SetInfoValue(n string, s byte, a int) { p.name = n p.sex = s p.age = a fmt.Print…
读匿名object对象的属性值 1.定义读object对象值的功能方法 public static class StaticClass { public static string ValueByKey(this object obj,string key) { Type type = obj.GetType(); //可以通过GetProperty取得对象指定的属性信息 PropertyInfo info = type.GetProperty("属性名"); PropertyInfo…