Partager via


ListGroupingCollection<TBusinessObject>.Add Method (String, Converter<TBusinessObject, ListGroup<TBusinessObject>>)

 

Adds a ListGrouping<TBusinessObject> object to the ListGroupingCollection<TBusinessObject> with the specified display name and the ListGroup<TBusinessObject> object that is returned from the specified delegate method. The delegate method assigns business objects to the appropriate ListGroup<TBusinessObject>.

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

Syntax

public ListGrouping<TBusinessObject> Add(
    string displayName,
    Converter<TBusinessObject, ListGroup<TBusinessObject>> businessObjectToGroup
)
public:
ListGrouping<TBusinessObject>^ Add(
    String^ displayName,
    Converter<TBusinessObject, ListGroup<TBusinessObject>^>^ businessObjectToGroup
)
Public Function Add (
    displayName As String,
    businessObjectToGroup As Converter(Of TBusinessObject, ListGroup(Of TBusinessObject))
) As ListGrouping(Of TBusinessObject)

Parameters

  • displayName
    Type: System.String

    The display name of the list group.

Return Value

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

An instance of ListGrouping<TBusinessObject> that was added to the ListGroupingCollection<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.

Examples

The following code example shows how to initialize a new ListGroupingCollection<TBusinessObject>, add a new ListGrouping<TBusinessObject> to the ListGroupingCollection<TBusinessObject>, and use a delegate method to associate objects to the group:

ListGroupingCollection<BusinessObject> groupings = null;
groupings = new ListGroupingCollection<BusinessObject>();
ListGrouping<BusinessObject> grouping = null;
grouping = groupings.Add("Network Name", GetObjectListGroup);

private static ListGroup<BusinessObject> GetObjectListGroup(
    BusinessObject businessObj)
{
    ListGroup<BusinessObject> group = null;
    group = new ListGroup<BusinessObject>(businessObj.NetworkName);

    return group;
}

See Also

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

Return to top