遍历所有的属性清空字符串的值

 public void ClearData()
        {
            System.Reflection.PropertyInfo[] properties = this.GetType().GetProperties();
            foreach (System.Reflection.PropertyInfo property in properties)
            {
                if (property.PropertyType.FullName=="System.String")
                property.SetValue(this, "", null);
            }
        }

你可能感兴趣的:(空字符串)