Run Code
|
API
|
Code Wall
|
Misc
|
Feedback
|
Login
|
Theme
|
Privacy
|
Patreon
Chandramouli
//Rextester.Program.Main is the entry point for your code. Don't change it. //Compiler version 4.0.30319.17929 for Microsoft (R) .NET Framework 4.5 using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; using System.Text; namespace Rextester { public class Program { public static void Main(string[] args) { List<int> RowNo = new List<int>(); List<Student> studentList1 = new List<Student>() { new Student() { StudentID = 1, StudentName = "John", Age = 13} , new Student() { StudentID = 2, StudentName = "Moin", Age = 21 } , new Student() { StudentID = 3, StudentName = "Bill", Age = 18 } , new Student() { StudentID = 4, StudentName = "Ram" , Age = 20} , new Student() { StudentID = 5, StudentName = "Ron" , Age = 15 } }; List<Student> studentList2 = new List<Student>() { new Student() { StudentID = 2, StudentName = "Chandra", Age = 21 } , new Student() { StudentID = 1, StudentName = "John", Age = 13} , new Student() { StudentID = 3, StudentName = "Bill", Age = 18 } , new Student() { StudentID = 4, StudentName = "Ram" , Age = 20} , new Student() { StudentID = 5, StudentName = "Ron" , Age = 15 } }; RowNo=studentList1.Select((s, index) => new { s, index }).Where(a => studentList2.Any(b => b.StudentName == a.s.StudentName)).Select(x => x.index).ToList(); Console.WriteLine(string.Join(",", RowNo)); } public class Student { public int StudentID { get; set; } public string StudentName { get; set; } public int Age { get; set; } } } }
run
|
edit
|
history
|
help
0
axasd
lala
Reflection 2
2
SingleLinkedList c# operations
Abstract Method Design Pattern in C#
Why Linqdb is cool if you are a Csharper
First Class
Compare 2 int
gggsggsgg