[Monodevelop-patches-list] r461 - trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Document/FoldingStrategy
commit-watcher at mono-cvs.ximian.com
commit-watcher at mono-cvs.ximian.com
Sun Jan 11 21:06:10 EST 2004
Author: benm
Date: 2004-01-11 21:06:10 -0500 (Sun, 11 Jan 2004)
New Revision: 461
Modified:
trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Document/FoldingStrategy/FoldingManager.cs
Log:
dont allocate tons of enumerators
Modified: trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Document/FoldingStrategy/FoldingManager.cs
===================================================================
--- trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Document/FoldingStrategy/FoldingManager.cs 2004-01-12 02:05:48 UTC (rev 460)
+++ trunk/MonoDevelop/src/Libraries/ICSharpCode.TextEditor/src/Document/FoldingStrategy/FoldingManager.cs 2004-01-12 02:06:10 UTC (rev 461)
@@ -53,8 +53,10 @@
public ArrayList GetFoldingsWithStart(int lineNumber)
{
ArrayList foldings = new ArrayList();
-
- foreach (FoldMarker fm in foldMarker) {
+
+ int c = foldMarker.Count;
+ for (int i = 0; i < c; i ++) {
+ FoldMarker fm = (FoldMarker)(foldMarker [i]);
if (fm.StartLine == lineNumber) {
foldings.Add(fm);
}
@@ -66,7 +68,9 @@
{
ArrayList foldings = new ArrayList();
- foreach (FoldMarker fm in foldMarker) {
+ int c = foldMarker.Count;
+ for (int i = 0; i < c; i ++) {
+ FoldMarker fm = (FoldMarker)(foldMarker [i]);
if (fm.EndLine == lineNumber) {
foldings.Add(fm);
}
@@ -76,7 +80,9 @@
public bool IsFoldStart(int lineNumber)
{
- foreach (FoldMarker fm in foldMarker) {
+ int c = foldMarker.Count;
+ for (int i = 0; i < c; i ++) {
+ FoldMarker fm = (FoldMarker)(foldMarker [i]);
if (fm.StartLine == lineNumber) {
return true;
}
@@ -86,7 +92,9 @@
public bool IsFoldEnd(int lineNumber)
{
- foreach (FoldMarker fm in foldMarker) {
+ int c = foldMarker.Count;
+ for (int i = 0; i < c; i ++) {
+ FoldMarker fm = (FoldMarker)(foldMarker [i]);
if (fm.EndLine == lineNumber) {
return true;
}
@@ -96,7 +104,9 @@
public bool IsBetweenFolding(int lineNumber)
{
- foreach (FoldMarker fm in foldMarker) {
+ int c = foldMarker.Count;
+ for (int i = 0; i < c; i ++) {
+ FoldMarker fm = (FoldMarker)(foldMarker [i]);
if (fm.StartLine < lineNumber && lineNumber < fm.EndLine) {
return true;
}
@@ -106,7 +116,9 @@
public bool IsLineVisible(int lineNumber)
{
- foreach (FoldMarker fm in foldMarker) {
+ int c = foldMarker.Count;
+ for (int i = 0; i < c; i ++) {
+ FoldMarker fm = (FoldMarker)(foldMarker [i]);
if (fm.IsFolded && fm.StartLine < lineNumber && lineNumber <= fm.EndLine) {
return false;
}
@@ -117,7 +129,9 @@
ArrayList GetTopLevelFoldedFoldings()
{
ArrayList foldings = new ArrayList();
- foreach (FoldMarker fm in foldMarker) {
+ int c = foldMarker.Count;
+ for (int i = 0; i < c; i ++) {
+ FoldMarker fm = (FoldMarker)(foldMarker [i]);
if (fm.IsFolded) {
foldings.Add(fm);
}
More information about the Monodevelop-patches-list
mailing list