Update
If Peter is correct, my answer makes no sense of course! I will leave it for now until Hiren has confirmed that the group memberships are indeed expanded automatically.
Original answer
As far as I know, the only way to do this is to go through the group memberships recursively. For example (untested code!!)
TrusteeData trustee = (TrusteeData) client.Read(TrusteeID, new ReadOptions());
List<GroupMembershipData> groupMemberships = GetGroupMemberships (trustee);
private List<GroupMembershipData> GetGroupMemberships (TrusteeData trustee)
{
List<GroupMembershipData> memberships = new List<GroupMembershipData>();
foreach (GroupMembershipData groupMshpData in trustee.GroupMemberships)
{
memberships.Add(groupMshpData.Group);
subMemberships = GetGroupMemberships(groupMshpData.Group);
if (subMemberships.Count > 0)
memberships.AddRange(subMemberships);
}
return memberships;
}