Jypeli  5
The simple game programming library
ReturnHelper.cs
Siirry tämän tiedoston dokumentaatioon.
1 using System;
2 using System.Collections.Generic;
3 using System.Linq;
4 using System.Text;
5 
6 namespace Jypeli
7 {
11  public static class ReturnHelper
12  {
19  public static T ReturnFirstNotNull<T>(params T[] list) where T : class
20  {
21  for ( int i = 0; i < list.Length; i++ )
22  {
23  if ( list[i] != null )
24  return list[i];
25  }
26 
27  return null;
28  }
29 
30  public static bool IsNotNull( int howMany, params object[] list )
31  {
32  int notNull = 0;
33 
34  for ( int i = 0; i < list.Length; i++ )
35  {
36  if ( list[i] != null ) notNull++;
37  if ( notNull >= howMany ) return true;
38  }
39 
40  return false;
41  }
42  }
43 }
Apuluokka palautusarvoille.
Definition: ReturnHelper.cs:11
static bool IsNotNull(int howMany, params object[] list)
Definition: ReturnHelper.cs:30
static T ReturnFirstNotNull< T >(params T[] list)
Palauttaa listasta ensimmäisen olion, joka ei ole null.
Definition: ReturnHelper.cs:19