~ubuntu-branches/ubuntu/precise/gnome-do/precise-backports

« back to all changes in this revision

Viewing changes to Do.Platform/src/System/Linq/EnumerableExtensions.cs

  • Committer: Bazaar Package Importer
  • Author(s): Christopher James Halse Rogers, Christopher James Halse Rogers, Iain Lane
  • Date: 2009-02-04 15:30:25 UTC
  • mfrom: (1.1.5 upstream)
  • Revision ID: james.westby@ubuntu.com-20090204153025-dhb2pm7dgbtmoib6
Tags: 0.8.0-1~ubuntu1
[ Christopher James Halse Rogers ]
* New upstream release.  (LP: #323048)
  + Fixes text input problems (LP: #288517)
  + No longer grabs plugins from internet repositories (LP: #294808)
  + Preferences dialog is resizable (LP: #305419)
* Build against gtk, gnome mono packages from Experimental. (Closes: #510836)
* debian/control:
  + Bump versioned dep on libgtk2.0-cil to ensure
    Gdk.Screen.IsComposited exists (Closes: #510973)
  + Add libwnck2.20-cil build-dep
  + gnome-sharp2 transition.
* debian/patches/04_fix_locale_dir
* debian/patches/05_fix_localised_theme_setting
* debian/patches/06_expand_homedir_in_open
  + Drop; fixed in new upstream  
* debian/patches/02_use_cli_for_wrapper
  + Update for new upstream
  + Add dpatch comments
* debian/gnome-do.1
  + Fix broken formatting (LP: #291654).  Thank you to Frédéric Grosshans
    for spotting it, and the patch.
  + Update for new version.

[ Iain Lane ]
* Tag pkg-cli-apps SVN revision into Jaunty, to get in before Feature
  Freeze. Should be a sync after the next Debian upload.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
// EnumerableExtensions.cs
 
2
//
 
3
// GNOME Do is the legal property of its developers. Please refer to the
 
4
// COPYRIGHT file distributed with this source distribution.
 
5
//
 
6
// This program is free software: you can redistribute it and/or modify
 
7
// it under the terms of the GNU General Public License as published by
 
8
// the Free Software Foundation, either version 3 of the License, or
 
9
// (at your option) any later version.
 
10
//
 
11
// This program is distributed in the hope that it will be useful,
 
12
// but WITHOUT ANY WARRANTY; without even the implied warranty of
 
13
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 
14
// GNU General Public License for more details.
 
15
//
 
16
// You should have received a copy of the GNU General Public License
 
17
// along with this program.  If not, see <http://www.gnu.org/licenses/>.
 
18
//
 
19
 
 
20
using System;
 
21
using System.Collections;
 
22
using System.Collections.Generic;
 
23
 
 
24
namespace System.Linq
 
25
{
 
26
        public static class EnumerableExtensions
 
27
        {
 
28
 
 
29
                /// <summary>
 
30
                /// Performs the specified action on each member of an enumerable.
 
31
                /// </summary>
 
32
                /// <param name="self">
 
33
                /// A <see cref="IEnumerable"/> whose members will have an action performed on them.
 
34
                /// </param>
 
35
                /// <param name="action">
 
36
                /// A <see cref="Action"/> to perform on each member.
 
37
                /// </param>
 
38
                /// <returns>
 
39
                /// The original <see cref="IEnumerable"/> for chaining.
 
40
                /// </returns>
 
41
                public static IEnumerable<T> ForEach<T> (this IEnumerable<T> self, Action<T> action)
 
42
                {
 
43
                        if (self == null) throw new ArgumentNullException ("self");
 
44
                        if (action == null) throw new ArgumentNullException ("action");
 
45
                        
 
46
                        foreach (T x in self) action (x);
 
47
                        return self;
 
48
                }
 
49
 
 
50
                /// <summary>
 
51
                /// Prepends ("cons") an element to an enumerable.
 
52
                /// </summary>
 
53
                /// <remarks>
 
54
                /// If maybeTs is null, a singleton enumerable is returned.
 
55
                /// </remarks>
 
56
                /// <param name="t">
 
57
                /// A <see cref="T"/> to prepend.
 
58
                /// </param>
 
59
                /// <param name="ts">
 
60
                /// A <see cref="IEnumerable"/> that may be null.
 
61
                /// </param>
 
62
                /// <returns>
 
63
                /// A <see cref="IEnumerable"/>
 
64
                /// </returns>
 
65
                public static IEnumerable<T> Cons<T> (this T t, IEnumerable<T> maybeTs)
 
66
                {
 
67
                        if (t == null) throw new ArgumentNullException ("t");
 
68
                        
 
69
                        yield return t;
 
70
                        if (maybeTs == null) yield break;
 
71
                        foreach (T x in maybeTs) yield return x;
 
72
                }
 
73
 
 
74
        }
 
75
}