1.多态 #多态 多态是指对象如何通过他们共同的属性和动作来操作及访问,而不需要考虑他们具体的类 运行时候,多种实现 反应运行时候状态 class H2O: def __init__(self,name,temperature): self.name = name self.temperature = temperature def turn_ice(self): if self.temperature < 0: print("[%s]温度太低结冰了" %self.name) e
1.在窗体中创建dataGridView显示表: using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; namespace WindowsFormsApplication1 { publ
如果遇到需要返回一个集合对象,其中该集合中的属性又是一个集合.第一种:可在考虑用外键关联,比如在控制器中可以采用预先加载的方式加载关联的数据,比如 RoleManager.Roles.Include<x =>r.Users>.ToList(); 第二种 可以考虑使用视图模型ViewModel的方式.第二种方式的适用范围更加广泛,第一种方式使用较为简单,但使用的场合有限. 一.建立视图模型 ViewModel public class IndexRoleViewModel { public