Skip to content

Commit 9e9f962

Browse files
authored
Fix more naming convention violations (ID->Id) (#18634)
1 parent 3eaaa8c commit 9e9f962

File tree

1 file changed

+26
-26
lines changed

1 file changed

+26
-26
lines changed

samples/snippets/csharp/VS_Snippets_VBCSharp/csProgGuideLINQ/CS/csrefLINQHowTos.cs

Lines changed: 26 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -37,47 +37,47 @@ protected class Student
3737
{
3838
public string FirstName { get; set; }
3939
public string LastName { get; set; }
40-
public int ID { get; set; }
40+
public int Id { get; set; }
4141
public GradeLevel Year;
4242
public List<int> ExamScores;
4343
}
4444

4545
protected static List<Student> students = new List<Student>
4646
{
47-
new Student {FirstName = "Terry", LastName = "Adams", ID = 120,
47+
new Student {FirstName = "Terry", LastName = "Adams", Id = 120,
4848
Year = GradeLevel.SecondYear,
4949
ExamScores = new List<int>{ 99, 82, 81, 79}},
50-
new Student {FirstName = "Fadi", LastName = "Fakhouri", ID = 116,
50+
new Student {FirstName = "Fadi", LastName = "Fakhouri", Id = 116,
5151
Year = GradeLevel.ThirdYear,
5252
ExamScores = new List<int>{ 99, 86, 90, 94}},
53-
new Student {FirstName = "Hanying", LastName = "Feng", ID = 117,
53+
new Student {FirstName = "Hanying", LastName = "Feng", Id = 117,
5454
Year = GradeLevel.FirstYear,
5555
ExamScores = new List<int>{ 93, 92, 80, 87}},
56-
new Student {FirstName = "Cesar", LastName = "Garcia", ID = 114,
56+
new Student {FirstName = "Cesar", LastName = "Garcia", Id = 114,
5757
Year = GradeLevel.FourthYear,
5858
ExamScores = new List<int>{ 97, 89, 85, 82}},
59-
new Student {FirstName = "Debra", LastName = "Garcia", ID = 115,
59+
new Student {FirstName = "Debra", LastName = "Garcia", Id = 115,
6060
Year = GradeLevel.ThirdYear,
6161
ExamScores = new List<int>{ 35, 72, 91, 70}},
62-
new Student {FirstName = "Hugo", LastName = "Garcia", ID = 118,
62+
new Student {FirstName = "Hugo", LastName = "Garcia", Id = 118,
6363
Year = GradeLevel.SecondYear,
6464
ExamScores = new List<int>{ 92, 90, 83, 78}},
65-
new Student {FirstName = "Sven", LastName = "Mortensen", ID = 113,
65+
new Student {FirstName = "Sven", LastName = "Mortensen", Id = 113,
6666
Year = GradeLevel.FirstYear,
6767
ExamScores = new List<int>{ 88, 94, 65, 91}},
68-
new Student {FirstName = "Claire", LastName = "O'Donnell", ID = 112,
68+
new Student {FirstName = "Claire", LastName = "O'Donnell", Id = 112,
6969
Year = GradeLevel.FourthYear,
7070
ExamScores = new List<int>{ 75, 84, 91, 39}},
71-
new Student {FirstName = "Svetlana", LastName = "Omelchenko", ID = 111,
71+
new Student {FirstName = "Svetlana", LastName = "Omelchenko", Id = 111,
7272
Year = GradeLevel.SecondYear,
7373
ExamScores = new List<int>{ 97, 92, 81, 60}},
74-
new Student {FirstName = "Lance", LastName = "Tucker", ID = 119,
74+
new Student {FirstName = "Lance", LastName = "Tucker", Id = 119,
7575
Year = GradeLevel.ThirdYear,
7676
ExamScores = new List<int>{ 68, 79, 88, 92}},
77-
new Student {FirstName = "Michael", LastName = "Tucker", ID = 122,
77+
new Student {FirstName = "Michael", LastName = "Tucker", Id = 122,
7878
Year = GradeLevel.FirstYear,
7979
ExamScores = new List<int>{ 94, 92, 91, 91}},
80-
new Student {FirstName = "Eugene", LastName = "Zabokritski", ID = 121,
80+
new Student {FirstName = "Eugene", LastName = "Zabokritski", Id = 121,
8181
Year = GradeLevel.FourthYear,
8282
ExamScores = new List<int>{ 96, 85, 91, 60}}
8383
};
@@ -171,7 +171,7 @@ private static void ReuseQuery()
171171
//Create the query. The use of var is optional here.
172172
var reusableQuery =
173173
from student in students
174-
where student.ID > 115
174+
where student.Id > 115
175175
select student;
176176

177177
// Execute the query. Note that enumerating over a query
@@ -188,14 +188,14 @@ where student.ID > 115
188188
// helpful names instead of reusing old query variables.
189189
reusableQuery =
190190
from student in reusableQuery
191-
where student.ID < 117
191+
where student.Id < 117
192192
select student;
193193

194194
Console.WriteLine(System.Environment.NewLine + "Reuse query variable as data source:");
195195

196196
// Execute the query after it has been reused
197197
// Note that only one student is returned,
198-
// the ID that is > 115 and < 117.
198+
// the Id that is > 115 and < 117.
199199

200200
foreach (var item in reusableQuery)
201201
{
@@ -623,14 +623,14 @@ from name in names
623623
let x = name.Split(',')
624624
from score in scores
625625
let s = score.Split(',')
626-
// Look for matching IDs from the two data files.
626+
// Look for matching Ids from the two data files.
627627
where x[2] == s[0]
628-
// If the IDs match, build a Student object.
628+
// If the Ids match, build a Student object.
629629
select new Student()
630630
{
631631
FirstName = x[0],
632632
LastName = x[1],
633-
ID = Convert.ToInt32(x[2]),
633+
Id = Convert.ToInt32(x[2]),
634634
ExamScores = (from scoreAsText in s.Skip(1)
635635
select Convert.ToInt32(scoreAsText)).
636636
ToList()
@@ -656,7 +656,7 @@ class Student
656656
{
657657
public string FirstName { get; set; }
658658
public string LastName { get; set; }
659-
public int ID { get; set; }
659+
public int Id { get; set; }
660660
public List<int> ExamScores { get; set; }
661661
}
662662

@@ -690,7 +690,7 @@ where score[0].ToString() == name.Substring(name.Length - 3, 3)
690690

691691
foreach (var item in queryNamesWithScores)
692692
{
693-
Console.WriteLine("Name and ID: {0}, Average Score: {1}", item.Name, item.TestScores.Average());
693+
Console.WriteLine("Name and Id: {0}, Average Score: {1}", item.Name, item.TestScores.Average());
694694
}
695695
//</snippet14>
696696

@@ -1077,17 +1077,17 @@ static void Main(string[] args)
10771077
Console.ReadKey();
10781078
}
10791079

1080-
static void QueryByID(string[] ids)
1080+
static void QueryById(string[] ids)
10811081
{
10821082
var queryNames =
10831083
from student in students
1084-
let i = student.ID.ToString()
1084+
let i = student.Id.ToString()
10851085
where ids.Contains(i)
1086-
select new { student.LastName, student.ID };
1086+
select new { student.LastName, student.Id };
10871087

10881088
foreach (var name in queryNames)
10891089
{
1090-
Console.WriteLine("{0}: {1}", name.LastName, name.ID);
1090+
Console.WriteLine("{0}: {1}", name.LastName, name.Id);
10911091
}
10921092
}
10931093
}
@@ -1144,7 +1144,7 @@ static void QueryByYear(string level)
11441144
Console.WriteLine("The following students are at level {0}", year.ToString());
11451145
foreach (Student name in studentQuery)
11461146
{
1147-
Console.WriteLine("{0}: {1}", name.LastName, name.ID);
1147+
Console.WriteLine("{0}: {1}", name.LastName, name.Id);
11481148
}
11491149
}
11501150
//</snippet27>

0 commit comments

Comments
 (0)