How can I get complete Understanding of group by

Hi Experts
Hope you all good I do not have .Net much knowledge I am really confuse of this given code in https://www.tutorialsteacher.com/ how can I fetch data from datatable as same record below
I am trying to use Method syntax like datatable.groupby() its not working here
also I am wondering what is a deferent in .Net syntax and uipath group by syntax as well as
in need to know how can I use lambda expression for I.E I have one datatable like dt1
and I am trying to consolidate data by using group by department like
dt1.AsEnumerable().groupby(fuction(x) x(2))
but I am getting error I am new I linq please help me out for complete understanding

IList studentList = new List() {
new Student() { StudentID = 1, StudentName = “John”, Age = 18 } ,
new Student() { StudentID = 2, StudentName = “Steve”, Age = 21 } ,
new Student() { StudentID = 3, StudentName = “Bill”, Age = 18 } ,
new Student() { StudentID = 4, StudentName = “Ram” , Age = 20 } ,
new Student() { StudentID = 5, StudentName = “Abram” , Age = 21 }
};
Dim groupQuery = From s In studentList
Group By s.Age Into Group

For Each group In groupQuery
Console.WriteLine(“Age Group: {0}”, group.Age) // Each group has key property name

For Each student In group.Group // Each group has inner collection
    Console.WriteLine("Student Name: {0}", student.StudentName)
Next

Next

GroupBy in Method Syntax
Dim groupQuery = studentList.GroupBy(Function(s) s.Age)

For Each ageGroup In groupQuery

Console.WriteLine("Age Group: {0}", ageGroup.Key)  //Each group has a key 
        
For Each student In ageGroup.AsEnumerable()  //Each group has a inner collection
    Console.WriteLine("Student Name: {0}", student.StudentName)
Next

other Question -

Private Shared Sub Sample_GroupBy_Lambda()
Dim numbers As Integer() = {10, 15, 20, 25, 30, 35}

Dim result = numbers.GroupBy(Function(n) (n Mod 10 = 0))

Debug.WriteLine("GroupBy has created two groups:")
For Each group As IGrouping(Of Boolean, Integer) In result
    If group.Key = True Then
        Debug.WriteLine("Divisible by 10")
    Else
        Debug.WriteLine("Not Divisible by 10")
    End If

    For Each number As Integer In group
        Debug.WriteLine(number)
    Next
Next

End Sub
I got this above code from learning site here my input
Dim numbers As Integer() = {10, 15, 20, 25, 30, 35}
numbers.GroupBy(Function(n) (n Mod 10 = 0))–this groupy function is only run array why its not work in datatable

can anyone help me?