仅提供中文版本
引用文章
今天在编程时进行列表的转换,同时对转换后列表进行删除操作。
1 | List<XYZ> A = firList; |
发现对A进行删除操作后,firList的列表也会随之进行删除。
具体原因目前没有查清,估计是因为内存占用的原因,导致两个列表会同时进行操作,具体原因未查清,插个旗子后面补充。
1 | List<XYZ> newFirList = new List<XYZ>(); |
后面通过对列表firList进行clone操作,这样两个列表的值可以互不影响。
Author: Broccoli
Copyright Notice: All articles on this blog are licensed under CC BY-NC-SA 4.0 unless otherwise stated.
Related Articles
2020-05-25
How to Compare Version Numbers in C#
Reference Article: C# How to compare version numbersIn C#, there is a Version class that can be used to compare version numbers.

2020-05-27
C# Software Auto-update via Database
Idea I read many blogs using local and server XML documents for updates, so I wondered if this could be done using a database.The basic idea is consistent with the general way. There will be a local XML file recording version number, update time, and local software address info. xml1234567891011<?xml version="1.0" encoding="utf-8" ?><AutoUpDater> <URLAdres url =""/> <UpdateInfo> <UpdateTime Date="2020-05-20"/> <...

2020-12-03
c# 字符串与16进制互导
参考链接:c#实现16进制和字符串之间转换的代码C#字符串与16进制的相互转换结果:code: 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455using System;using System.Collections.Generic;using System.IO;using System.Linq;using System.Text;using System.Threading.Tasks;namespace ConsoleApp{ class Program { static void Main(string[] args) { string path = @"F:\mrm\publicShare\thumbnails"; var directory = Directory.GetFiles...
2020-06-19
C# wpf 智能选择对话框
参考链接:WPF-15:AutoCompleteBox的使用(实现下拉列表)WPF: AutoCompleteBox, an autocomplete text box如果出现未能加载程序集,可以参照这篇回答 准备:WpfToolKit.dll,System.Windows.Controls.Input.Toolkit.dll下载或通过nuget搜索安装,下载链接在第一个博客中 内容:前端通过wpftool框架实现自动补全信息或智能选择的功能在前端添加xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Input.Toolkit"在窗口内实现AutoCompleteBox 1234567891011<toolkit:AutoCompleteBox x:Name="searchTextBox" Grid.Row="1" ValueMemberPath="SerchString" ...

2021-10-13
C# Writing Data to Word via Template
Project interface created based on reference download link: Method to automatically create Word document via template in C#, but the resource is a txt file, need to type the code manually, considered as practice.Before starting, we need to install Microsoft.Office.Interop.Word from NuGet. Below is the code needed, just copy it directly. It is slightly different from using NPOI. 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626...
2020-08-26
Get Enum Value and DescriptionAttribute from String
Get Enum Value from String1var em = (ChooseEnum) Enum.Parse( typeof(ChooseEnum), desc); Get DescriptionAttribute from Enum Value12345678910111213141516171819public static string ConvertToSql(Enum value) { Type enumType = value.GetType(); string name = Enum.GetName(enumType, value); if (name != null) { FieldInfo fieldInfo = enumType.GetField(name); if (fieldInfo != null) { D...
Announcement
欢迎访问!右上角可切换中英文。感谢您的阅读!

