mongodb/mongo-csharp-driver — pull request #81 by optimiz3 (2012-02-07 05:10:58+00:00)
Title: Implement JIRA CSHARP-385 - Add BsonIgnoreIfDefaultAttribute

In .Net null is a subset of default(T), as null is the default value for reference types. Providing BsonIgnoreIfDefaultAttribute generalizes this functionality and extends it to value types. As a result, BsonIgnoreIfNullAttribute is deprecated and superseded with BsonIgnoreIfDefaultAttribute.

Additionally, BsonDefaultValueAttribute.SerializeDefaultValue is also deprecated as it requires the user to define a default value, even if there was no user intent to override the default value. BsonDefaultValueAttribute.SerializeDefaultValue is also problematic because it requires the user to have access to a constant, which makes usage with non-constant defaults such as DateTime.MinValue impossible due to DateTime.MinValue being a readonly instance.