Skip to main content
A newer version of this page is available. .
.NET Framework 4.5.2+

EmptyEntriesMode Enum

Specifies the behavior of the ObjectFormatter.Format method, when a format item in the string passed to it corresponds to a property that contains a null(Nothing in VB) or empty value.

Namespace: DevExpress.Persistent.Base

Assembly: DevExpress.ExpressApp.v19.2.dll

Declaration

public enum EmptyEntriesMode

Members

Name Description
Default

Considered when a string passed to the ObjectFormatter.Format method contains format items that must be replaced by null(Nothing in VB) or empty values. Specifies that such format items must be removed.

RemoveDelimiterWhenEntryIsEmpty

Considered when a string passed to the ObjectFormatter.Format method contains format items that must be replaced by the null(Nothing in VB) or empty values. Specifies that such format items and the delimiter strings that precede them must be removed.

RemoveDelimeterWhenEntryIsEmpty

Obsolete. Use RemoveDelimiterWhenEntryIsEmpty instead.

Remarks

Consider the following example. In it, we define a new Contact persistent object. Then, we define the FullName1 and FullName2 string variables that are constructed using the Contact object’s LastName and FirstName properties.

Contact john = new Contact();
john.LastName = "Doe";
john.FirstName = "John";

string FullName1 = ObjectFormatter.Format(
    "{LastName}, {FirstName}", john, EmptyEntriesMode.Default);
string FullName2 = ObjectFormatter.Format(
    "{LastName}, {FirstName}", john, EmptyEntriesMode.RemoveDelimiterWhenEntryIsEmpty );

// FullName1 = "Doe, John"
// FullName2 = "Doe, John"

Since in this code snippet both the LastName and FirstName properties have non-empty values, the FullName1 and FullName2 variables contain the same string - “Doe, John”.

Now, we remove the FirstName property’s initialization.

Contact john = new Contact();
john.LastName = "Doe";

string FullName1 = ObjectFormatter.Format(
"{LastName}, {FirstName}", john, EmptyEntriesMode.Default); 
string FullName2 = ObjectFormatter.Format(
"{LastName}, {FirstName}", john, EmptyEntriesMode.RemoveDelimiterWhenEntryIsEmpty ); 

// FullName1 = "Doe,"
// FullName2 = "Doe"

The FullName1 and FullName2 variables contain different strings.

The FullName1 variable was constructed using the EmptyEntriesMode.Default mode. Since the FirstName property is not initialized and contains a null(Nothing in VB) value, the “{FirstName}” format item was removed from the resulting string.

The FullName2 variable was constructed using the EmptyEntriesMode.RemoveDelimiterWhenEntryIsEmpty mode. The “{FirstName}” format item was removed from the resulting string. Additionally, the delimiter string that precedes the “{FirstName}” format item was removed. In this instance - the comma character.

See Also