mirror of
https://github.com/LorenzCK/OnTopReplica.git
synced 2024-05-21 04:43:55 +12:00
Small style changes.
This commit is contained in:
parent
34a190dbde
commit
726cfcb755
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
}
|
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Reference in a new issue