ntwain/NTwain/Extensions.cs

22 lines
640 B
C#
Raw Normal View History

2014-04-08 07:21:33 +08:00
using NTwain.Properties;
using System;
2014-04-03 07:01:21 +08:00
namespace NTwain
{
2014-04-20 20:10:20 +08:00
static class Extensions
2014-04-03 07:01:21 +08:00
{
/// <summary>
/// Verifies the string length is under the maximum length
/// and throws <see cref="ArgumentException"/> if violated.
/// </summary>
/// <param name="value">The value.</param>
/// <param name="maxLength">The maximum length.</param>
internal static void VerifyLengthUnder(this string value, int maxLength)
{
if (value != null && value.Length > maxLength)
throw new ArgumentException(Resources.MaxStringLengthExceeded);
}
}
}