Partager via


ListColumnCollection<TBusinessObject>.Add Method (String, Converter<TBusinessObject, String>)

 

Adds a ListColumn<TBusinessObject> object to the ListColumnCollection<TBusinessObject> with the specified display name and the display value that is returned from the specified delegate method. The delegate method converts information from a business object to a string that is used as the display value for the object in the column.

Namespace:   Microsoft.WindowsServerSolutions.Administration.ObjectModel
Assembly:  Microsoft.WindowsServerSolutions.Administration.ObjectModel (in Microsoft.WindowsServerSolutions.Administration.ObjectModel.dll)

Syntax

public ListColumn<TBusinessObject> Add(
    string displayName,
    Converter<TBusinessObject, string> displayValueProvider
)
public:
ListColumn<TBusinessObject>^ Add(
    String^ displayName,
    Converter<TBusinessObject, String^>^ displayValueProvider
)
Public Function Add (
    displayName As String,
    displayValueProvider As Converter(Of TBusinessObject, String)
) As ListColumn(Of TBusinessObject)

Parameters

  • displayName
    Type: System.String

    The display name of the column.

Return Value

Type: Microsoft.WindowsServerSolutions.Administration.ObjectModel.ListColumn<TBusinessObject>

An instance of ListColumn<TBusinessObject> that was added to the ListColumnCollection<TBusinessObject>.

Exceptions

Exception Condition
ArgumentException

One or more of the parameters are not valid.

ArgumentNullException

One or more of the parameters are null.

Remarks

TBusinessObject represents a business object that encapsulates information and methods that relate to business data or business functionality. The information in the business object is exposed as properties.

The delegate method represented by displayValueProvider can be used to add additional data or related data to the information that is provided by the business object.

Examples

The following code example shows a how to initialize a ListColumnCollection<TBusinessObject> that includes a delegate method, which converts a business object to a string that is displayed for the objects in the column:

ListColumnCollection<BusinessObject> columns = null;
columns = new ListColumnCollection<BusinessObject>();

ListColumn<BusinessObject> column = null;
column = columns.Add("Computer Name", GetListColumnString);

private static string GetListColumnString(BusinessObject businessObj)
{
    return businessObj.ComputerName + " some additional text";
}

See Also

Add Overload
ListColumnCollection<TBusinessObject> Class
Microsoft.WindowsServerSolutions.Administration.ObjectModel Namespace

Return to top