English 中文(简体)
• 提供参考资料本身?
原标题:Making a Copy of Reference itself?
  • 时间:2011-10-19 09:33:28
  •  标签:
  • c#
  • .net

是否有办法让我提供一份参考文件本身的副本? 例如,我在表格上增加了对名单的控制,我希望坚持其项目收集,即。

ListViewItemCollection lvic = ListView.Items();

页: 1 清单编号:Clear(),不应清除。

最佳回答

克隆/复制是一个广泛主题。 这确实取决于具体情况。 如果是的话,你可以简单地用林克复制收集资料。

ListViewItem[] copiedItems = ListView.Items().OfType<ListViewItem>().ToArray();

在这种情形下使用克隆技术。 清单目录的收集工作不能被分配到清单中,清单或清单的复印件仍然使用一些本地资源(在双赢和世界范围内),这样复制就会在错误使用时造成可怕的ug。

问题回答

B. 方便尝试

  ListViewItem[] items = new ListViewItem[listView1.Items.Count];
  listView1.Items.CopyTo(items, 0);

页: 1

您需要打造标语的面孔,以便你能够检查这个讨论题材克隆问题的岗位:

本条讨论了两种类型的克隆。

1. Deep Cloning
2. Shallow Copy




相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签