winfrom中DataGridView在的单元格在编辑时候会修改它的数据源的,如果我们遇到这样一种情景,刷新数据源到原始状态,这个时候要么数据源的重新获取绑定,要么通过拷贝一份原始档的数据再绑定处理,这里介绍拷贝方式处理。
大致代码如下:
1.目标对需要序列化,并实现ICloneable 接口:
[Serializable]
public class DtoColumn : ICloneable2.实现接口方法Clone:
public object Clone()
{
using (MemoryStream ms = new MemoryStream(capacity))