[gmime] Fixed Multipart.custom's GetEnumerator()
- From: Jeffrey Stedfast <fejj src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gmime] Fixed Multipart.custom's GetEnumerator()
- Date: Mon, 15 Aug 2011 03:04:22 +0000 (UTC)
commit de98274b51c0ee1aaa8ed331bd1b01f348e535f8
Author: Jeffrey Stedfast <fejj gnome org>
Date: Sun Aug 14 23:04:03 2011 -0400
Fixed Multipart.custom's GetEnumerator()
mono/Multipart.custom | 33 ++++++---------------------------
1 files changed, 6 insertions(+), 27 deletions(-)
---
diff --git a/mono/Multipart.custom b/mono/Multipart.custom
index bf22d08..aaf717c 100644
--- a/mono/Multipart.custom
+++ b/mono/Multipart.custom
@@ -143,7 +143,12 @@
public IEnumerator GetEnumerator ()
{
- return new GMimeMultipartIterator (this);
+ int n = Count;
+
+ for (int i = 0; i < n; i++)
+ yield return this[i];
+
+ yield break;
}
public int IndexOf (GMime.Entity part)
@@ -241,29 +246,3 @@
this[index] = value as GMime.Entity;
}
}
-
- internal class GMimeMultipartIterator : IEnumerator {
- GMime.Multipart multipart;
- int index = -1;
-
- public GMimeMultipartIterator (GMime.Multipart multipart)
- {
- this.multipart = multipart;
- }
-
- public object Current {
- get { return multipart[index]; }
- }
-
- public void Reset ()
- {
- index = -1;
- }
-
- public bool MoveNext ()
- {
- index++;
-
- return index < multipart.Count;
- }
- }
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]