Click or drag to resize

ArgumentGuard Class

Set of tools to check the API method arguments.
Inheritance Hierarchy
SystemObject
  KSPDev.ProcessingUtilsArgumentGuard

Namespace:  KSPDev.ProcessingUtils
Assembly:  KSPDev_Utils.1.2 (in KSPDev_Utils.1.2.dll) Version: 1.2 for KSP v1.6+
Syntax
C#
public static class ArgumentGuard
Request Example View Source

The ArgumentGuard type exposes the following members.

Methods
  NameDescription
Public methodStatic memberHasElements
Throws if collection is empty.
Public methodStatic memberHasSize
Throws if collection has not the expected number of elements.
Public methodStatic memberInRangeT
Throws if ordinary value is out of bounds.
Public methodStatic memberNotNull
Throws if argument is null.
Public methodStatic memberNotNullOrEmpty
Throws if string is null or empty.
Public methodStatic memberOneOfT
Throws if enum value is not in the expected set.
Top
Remarks
The public API method can be called with an appropriate arguments. It's always a good idea to fail earlier with a clear message rather than trying to use the wrong value and crash. Always check the arguments for the accepted values. The only good reason to break this rule is providing a high frequency API method.
See Also