天道酬勤,学无止境

stringcollection

System.Collections.Specialized.StringCollection 设置在调试和发布中工作正常但在部署时崩溃?(System.Collections.Specialized.StringCollection settings work fine in Debug and Release but crash on Deployment?)

问题 对于我最新的 WPF 应用程序,我一直在使用System.Collections.Specialized.StringCollection来保存和加载字符串。 我当前的系统在 Debug 和 Release 中就像一个魅力,但是当部署到 ClickOnce 时,只要涉及到任何设置(加载或保存),应用程序就会崩溃! 但是,如果不是设置, System.Collections.Specialized.StringCollections本身就可以正常工作。 什么可能导致这些崩溃? 这是我的系统: public static void SaveCharacter(string code) { // Declare a blank StringCollection StringCollection strings = new StringCollection(); // Convert the current settings StringCollection into an array and combine with the blank one if (Settings.Default.SavedCharacters.Count > 0) { string[] tempArr= new string[Settings.Default.SavedCharacters.Count]

2021-10-25 18:10:13    分类:技术分享    c#   list   settings   clickonce   stringcollection

System.Collections.Specialized.StringCollection settings work fine in Debug and Release but crash on Deployment?

For my latest WPF application, I've been using an System.Collections.Specialized.StringCollection to save and load strings. My current system works like a charm in Debug and Release, but when deployed to ClickOnce, the application crashes as soon as anything involving the settings are involved (loading or saving)! However, System.Collections.Specialized.StringCollections work just fine on their own if not a setting. What could be causing these crashes? Here are my systems: public static void SaveCharacter(string code) { // Declare a blank StringCollection StringCollection strings = new

2021-10-20 17:50:15    分类:问答    c#   list   settings   clickonce   stringcollection

Performance concern: StringCollection vs List<String>

I was wondering when I should use List< string > and when I should use StringCollection. Let's say that I have to deal with large number of strings (like text files of 10mb). I know that List< T > provides more powerful functions than StringCollection. But sometimes I kind of find the List< T > slow when for example telling a Gridview that its datasource is a List< String >... So do anyone know the pros and cons of these collections, concerning speed and weight in memory? Concerning their functionalities, I am sure everybody will agree to say that List is the best, so my question is not about

2021-05-16 17:52:53    分类:问答    c#   performance   list   .net-4.0   stringcollection