RVTDocs.com
Namespace: Autodesk.Revit.DB

Group

Class
Description:
An element representing a single instance of a group of elements that may be placed many times in a project or family.
Remarks:
Grouping elements is useful when you need to create entities that represent repeating layouts or are common to many building projects, such as hotel rooms, apartments, or repeating floors.
Inheritance Hierarchy:
System.Object
  Autodesk.Revit.DB.Element
    Autodesk.Revit.DB.Group
Syntax
public class Group : Element
Examples
private void ShowGroupInformation(Autodesk.Revit.DB.Document document, Autodesk.Revit.DB.Element element)
{
    // Get group information for the selected element
    String prompt = null;
    if (element.GroupId.Equals(ElementId.InvalidElementId))
    {
        prompt = "The element isn't in any group.";
    }
    else
    {
       Autodesk.Revit.DB.Group group = document.GetElement(element.GroupId) as Autodesk.Revit.DB.Group;

        prompt = "The element " + element.Id.ToString() + " is in a group.";
        prompt += "\nThe group id is " + group.Id.ToString();
        prompt += "\nThe group's category is " + group.Category.Name;
        prompt += "\nAll group contained element ids are:";
        IList<ElementId> memberIds = group.GetMemberIds();
        foreach (ElementId id in memberIds)
        {
            prompt += "\n\t" + id.ToString();
        }
    }

    TaskDialog.Show("Revit",prompt);
}