#region " © Copyright 2005-07 to Marcos Meli - http://www.marcosmeli.com.ar" // Errors, suggestions, contributions, send a mail to: marcos@filehelpers.com. #endregion using System; namespace FileHelpers { /// Indicates the value to assign to the field in the case of find a "NULL". /// See the Complete Attributes List for more clear info and examples of each one. /// Attributes List /// Quick Start Guide /// Examples of Use [AttributeUsage(AttributeTargets.Field)] public sealed class FieldNullValueAttribute : Attribute { internal object NullValue; // internal bool NullValueOnWrite = false; /// Indicates directly the null value. /// The value to assign in the "NULL" case. public FieldNullValueAttribute(object nullValue) { NullValue = nullValue; // NullValueOnWrite = useOnWrite; } // /// Indicates directly the null value. // /// The value to assign in the "NULL" case. // public FieldNullValueAttribute(object nullValue): this(nullValue, false) // {} // /// Indicates a type and a string to be converted to that type. // /// The type of the null value. // /// The string to be converted to the specified type. // /// Indicates that if the field has that value when the library writes, then the engine use an empty string. // public FieldNullValueAttribute(Type type, string nullValue, bool useOnWrite):this(Convert.ChangeType(nullValue, type, null), useOnWrite) // {} /// Indicates a type and a string to be converted to that type. /// The type of the null value. /// The string to be converted to the specified type. public FieldNullValueAttribute(Type type, string nullValue):this(Convert.ChangeType(nullValue, type, null)) {} } }