Skip to content

Commit 1cff1a6

Browse files
authored
Fix the CoOrds class (#9763)
1 parent 05abaf3 commit 1cff1a6

File tree

9 files changed

+38
-38
lines changed

9 files changed

+38
-38
lines changed

docs/csharp/programming-guide/classes-and-structs/codesnippet/CSharp/index_4.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
public struct CoOrds
1+
public struct Coords
22
{
33
public int x, y;
44

5-
public CoOrds(int p1, int p2)
5+
public Coords(int p1, int p2)
66
{
77
x = p1;
88
y = p2;

docs/csharp/programming-guide/classes-and-structs/codesnippet/CSharp/instance-constructors_1.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
class CoOrds
1+
class Coords
22
{
33
public int x, y;
44

55
// constructor
6-
public CoOrds()
6+
public Coords()
77
{
88
x = 0;
99
y = 0;

docs/csharp/programming-guide/classes-and-structs/codesnippet/CSharp/instance-constructors_2.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
// A constructor with two arguments:
2-
public CoOrds(int x, int y)
2+
public Coords(int x, int y)
33
{
44
this.x = x;
55
this.y = y;
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
CoOrds p1 = new CoOrds();
2-
CoOrds p2 = new CoOrds(5, 3);
1+
Coords p1 = new Coords();
2+
Coords p2 = new Coords(5, 3);
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,16 @@
1-
class CoOrds
1+
class Coords
22
{
33
public int x, y;
44

55
// Default constructor:
6-
public CoOrds()
6+
public Coords()
77
{
88
x = 0;
99
y = 0;
1010
}
1111

1212
// A constructor with two arguments:
13-
public CoOrds(int x, int y)
13+
public Coords(int x, int y)
1414
{
1515
this.x = x;
1616
this.y = y;
@@ -27,16 +27,16 @@ class MainClass
2727
{
2828
static void Main()
2929
{
30-
CoOrds p1 = new CoOrds();
31-
CoOrds p2 = new CoOrds(5, 3);
30+
Coords p1 = new Coords();
31+
Coords p2 = new Coords(5, 3);
3232

3333
// Display the results using the overriden ToString method:
34-
Console.WriteLine("CoOrds #1 at {0}", p1);
35-
Console.WriteLine("CoOrds #2 at {0}", p2);
34+
Console.WriteLine("Coords #1 at {0}", p1);
35+
Console.WriteLine("Coords #2 at {0}", p2);
3636
Console.ReadKey();
3737
}
3838
}
3939
/* Output:
40-
CoOrds #1 at (0,0)
41-
CoOrds #2 at (5,3)
40+
Coords #1 at (0,0)
41+
Coords #2 at (5,3)
4242
*/
Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,34 @@
1-
public partial class CoOrds
1+
public partial class Coords
22
{
33
private int x;
44
private int y;
55

6-
public CoOrds(int x, int y)
6+
public Coords(int x, int y)
77
{
88
this.x = x;
99
this.y = y;
1010
}
1111
}
1212

13-
public partial class CoOrds
13+
public partial class Coords
1414
{
15-
public void PrintCoOrds()
15+
public void PrintCoords()
1616
{
17-
Console.WriteLine("CoOrds: {0},{1}", x, y);
17+
Console.WriteLine("Coords: {0},{1}", x, y);
1818
}
1919

2020
}
2121

22-
class TestCoOrds
22+
class TestCoords
2323
{
2424
static void Main()
2525
{
26-
CoOrds myCoOrds = new CoOrds(10, 15);
27-
myCoOrds.PrintCoOrds();
26+
Coords myCoords = new Coords(10, 15);
27+
myCoords.PrintCoords();
2828

2929
// Keep the console window open in debug mode.
3030
Console.WriteLine("Press any key to exit.");
3131
Console.ReadKey();
3232
}
3333
}
34-
// Output: CoOrds: 10,15
34+
// Output: Coords: 10,15

docs/csharp/programming-guide/classes-and-structs/codesnippet/CSharp/using-structs_1.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
public struct CoOrds
1+
public struct Coords
22
{
33
public int x, y;
44

5-
public CoOrds(int p1, int p2)
5+
public Coords(int p1, int p2)
66
{
77
x = p1;
88
y = p2;
Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
// Declare and initialize struct objects.
2-
class TestCoOrds
2+
class TestCoords
33
{
44
static void Main()
55
{
66
// Initialize:
7-
CoOrds coords1 = new CoOrds();
8-
CoOrds coords2 = new CoOrds(10, 10);
7+
Coords coords1 = new Coords();
8+
Coords coords2 = new Coords(10, 10);
99

1010
// Display results:
11-
Console.Write("CoOrds 1: ");
11+
Console.Write("Coords 1: ");
1212
Console.WriteLine("x = {0}, y = {1}", coords1.x, coords1.y);
1313

14-
Console.Write("CoOrds 2: ");
14+
Console.Write("Coords 2: ");
1515
Console.WriteLine("x = {0}, y = {1}", coords2.x, coords2.y);
1616

1717
// Keep the console window open in debug mode.
@@ -20,6 +20,6 @@ static void Main()
2020
}
2121
}
2222
/* Output:
23-
CoOrds 1: x = 0, y = 0
24-
CoOrds 2: x = 10, y = 10
23+
Coords 1: x = 0, y = 0
24+
Coords 2: x = 10, y = 10
2525
*/
Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
// Declare a struct object without "new."
2-
class TestCoOrdsNoNew
2+
class TestCoordsNoNew
33
{
44
static void Main()
55
{
66
// Declare an object:
7-
CoOrds coords1;
7+
Coords coords1;
88

99
// Initialize:
1010
coords1.x = 10;
1111
coords1.y = 20;
1212

1313
// Display results:
14-
Console.Write("CoOrds 1: ");
14+
Console.Write("Coords 1: ");
1515
Console.WriteLine("x = {0}, y = {1}", coords1.x, coords1.y);
1616

1717
// Keep the console window open in debug mode.
1818
Console.WriteLine("Press any key to exit.");
1919
Console.ReadKey();
2020
}
2121
}
22-
// Output: CoOrds 1: x = 10, y = 20
22+
// Output: Coords 1: x = 10, y = 20

0 commit comments

Comments
 (0)