天马行空工作室

导航

随笔分类 -  .NET系列

C#、.NET、Winfrom、Asp.net、Silverlight等相关内容
C#中数组是引用类型
摘要:C#中数组是引用类型,都基础自Array类,这个跟JAVA很相似。最近在开发一个系统的时候,在List中存放数组(List<int[]>),运行结果发现列表中的所有项的值都是一样的(与最后一项一致);开始以为是List的容量问题(数据量可能在百万左右),导致了内存溢出,所以才出现这个问题;后来仔细测试发现,当List的容量很小的时候,仍然出现相同问题,如是怀疑不是List的容量问题,后来怀疑是数组的问题,因为每次循环的时候都只是改动数组的值,而List中Add同一个名称的数组,于是改成Clone,问题解决了。 阅读全文

posted @ 2011-11-29 20:11 天马行空工作室 阅读(706) 评论(0) 推荐(0)

C#中如何实现JAVA中的String.replaceAll()方法功能
摘要:JDK原文注释:String java.lang.String.replaceAll(String regex, String replacement)replaceAllpublic String replaceAll(Stringregex, Stringreplacement)Replaces each substring of this string that matches the given regular expressionwith the given replacement.An invocation of this metho... 阅读全文

posted @ 2011-11-21 20:51 天马行空工作室 阅读(2020) 评论(0) 推荐(0)