According to your query, those names would come under one group which has same Dep and same YearofJoin. Therefore, from the given example, we would get 3 groups (2010_d), (2010_g) and (2012_g)
var studentGroups = from s in students
group s by string.Format("{0}_{1}", s.YearofJoin, s.Dep) into g
select new { GroupId = g.Key, StudentInfo = g };
foreach (var sg in studentGroups)
{
foreach (var s in sg.StudentInfo)
{
}
}