Small style changes.

This commit is contained in:
Lorenz Cuno Klopfenstein 2011-03-27 22:12:31 +02:00
parent 34a190dbde
commit 726cfcb755
3 changed files with 14 additions and 24 deletions

View file

@ -5,6 +5,7 @@ using System.Text;
namespace OnTopReplica {
/// <summary>
/// Extension methods for IEnumerable.
/// Poor man's LINQ.
/// </summary>
static class EnumerableExtensions {
@ -23,5 +24,16 @@ namespace OnTopReplica {
}
}
/// <summary>
/// Checks whether an enumeration contains a value.
/// </summary>
public static bool Contains<T>(this IEnumerable<T> collection, T value) {
foreach (var v in collection)
if (v.Equals(value))
return true;
return false;
}
}
}

View file

@ -1,22 +0,0 @@
using System;
using System.Collections.Generic;
using System.Text;
namespace OnTopReplica {
/// <summary>
/// Poor man's LINQ.
/// </summary>
static class EnumerationExtensions {
public static bool Contains<T>(IEnumerable<T> collection, T value){
foreach (var v in collection)
if (v.Equals(value))
return true;
return false;
}
}
}

View file

@ -36,12 +36,12 @@ namespace OnTopReplica {
}
//List of characters to ignore on KeyPress events (because they generate bell rings)
char[] _ignoreChars = new char[] {
readonly char[] IgnoreChars = new char[] {
(char)27, (char)13
};
protected override void OnKeyPress(KeyPressEventArgs e) {
if (EnumerationExtensions.Contains(_ignoreChars, e.KeyChar)) {
if (IgnoreChars.Contains(e.KeyChar)) {
e.Handled = true;
}