I think this extension method should do it:
public static class GroupTableExtensionMethods
{
/// <summary>
/// Returns the layer indices of Group members
/// </summary>
public static int[] GroupLayers(this GroupTable groupTable, int groupIndex)
{
if (groupIndex > 0 && groupIndex < groupTable.Count)
{
var rhino_objects = groupTable.GroupMembers(groupIndex);
var hash_set = new HashSet<int>();
foreach (var rh_obj in rhino_objects)
hash_set.Add(rh_obj.Attributes.LayerIndex);
return hash_set.ToArray();
}
return new int[0];
}
}