singrdk/base/Applications/Runtime/Full/System/ArgumentNullException.cs

57 lines
1.9 KiB
C#
Raw Permalink Normal View History

2008-03-05 09:52:00 -05:00
// ==++==
//
// Copyright (c) Microsoft Corporation. All rights reserved.
//
// ==--==
2008-11-17 18:29:00 -05:00
//=============================================================================
//
// Class: ArgumentNullException
//
// Purpose: Exception class for null arguments to a method.
//
//=============================================================================
2008-03-05 09:52:00 -05:00
2008-11-17 18:29:00 -05:00
namespace System
{
2008-03-05 09:52:00 -05:00
using System;
// The ArgumentException is thrown when an argument
// is null when it shouldn't be.
//
//| <include path='docs/doc[@for="ArgumentNullException"]/*' />
public class ArgumentNullException : ArgumentException
{
private static String _nullMessage = null;
private static String NullMessage {
get {
// Don't bother with synchronization here. A duplicated string
// is not a major problem.
if (_nullMessage == null)
_nullMessage = "ArgumentNull_Generic";
return _nullMessage;
}
}
// Creates a new ArgumentNullException with its message
// string set to a default message explaining an argument was null.
//| <include path='docs/doc[@for="ArgumentNullException.ArgumentNullException"]/*' />
public ArgumentNullException()
: base(NullMessage) {
// Use E_POINTER - COM used that for null pointers. Description is "invalid pointer"
}
//| <include path='docs/doc[@for="ArgumentNullException.ArgumentNullException1"]/*' />
public ArgumentNullException(String paramName)
: base(NullMessage, paramName) {
}
//| <include path='docs/doc[@for="ArgumentNullException.ArgumentNullException2"]/*' />
public ArgumentNullException(String paramName, String message)
: base(message, paramName) {
}
}
}