GenericExtensions¶
Generic-object helpers: throw-if-null with a custom exception type, a reference/value-aware null test, and JSON/XML string conversion shortcuts. (BR-058)
Purpose¶
- Generic-object helpers: throw-if-null with a custom exception type, a reference/value-aware null test, and JSON/XML string conversion shortcuts. (BR-058)
Context¶
- Namespace:
SAIF.Common.Extensions - Assembly/package:
SAIF.Framework.Common
Public members¶
| Member | Signature | Purpose |
|---|---|---|
| IfNullThrow |
public static T IfNullThrow<T,TException>(this T value) where TException : Exception, new() |
Throws a new TException when value is null; otherwise returns value unchanged. |
| IsNull |
public static bool IsNull<T>(this T value) |
Null test that works correctly for both reference types and nullable value types. |
| ToJsonString |
public static string ToJsonString<T>(this T value) |
Serializes any object to a JSON string via the library's Serializer. (BR-058) |
| ToXmlString |
public static string ToXmlString<T>(this T value) |
Serializes any object to an XML string via the library's Serializer. (BR-058) |
Sources¶
Common/SAIF.Common/Extensions/GenericExtensions.cs