Skip to main content
.NET 8.0+

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

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.v24.2.dll

NuGet Package: DevExpress.ExpressApp

#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.

#Related API Members

The following properties accept/return EmptyEntriesMode values:

#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