Skip to content

Normalize trailing spaces in samples, Part 1 #4119

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Apr 17, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
/*
This program implments the remote method which will be called by the
client.
client.
*/
using System;
namespace RemotingSamples
namespace RemotingSamples
{
public class HelloServer : MarshalByRefObject
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
/*
The class 'PrintServer' is derived from 'MarshalByRefObject' to
make it remotable.
The class 'PrintServer' is derived from 'MarshalByRefObject' to
make it remotable.
*/
using System;
using System.Runtime.Remoting;
public class PrintServer : MarshalByRefObject
{
public int MyPrintMethod(String myString, double fValue, int iValue)
{
Console.WriteLine("PrintServer.MyPrintMethod {0} {1} {2}",
Console.WriteLine("PrintServer.MyPrintMethod {0} {1} {2}",
myString, fValue, iValue);
return iValue;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,14 @@ define the methods to execute from the client. */

using System;

public class MyHelloServer : MarshalByRefObject
public class MyHelloServer : MarshalByRefObject
{
public MyHelloServer()
public MyHelloServer()
{
Console.WriteLine("HelloServer activated");
}

public String myHelloMethod(String myString)
public String myHelloMethod(String myString)
{
Console.WriteLine("Hello.HelloMethod : {0}", myString);
return "Hi there " + myString;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
using System;

public class MyServerImpl :MarshalByRefObject
public class MyServerImpl :MarshalByRefObject
{
public MyServerImpl()
{
Console.WriteLine("Server Activated...");
}

public String MyMethod(String name)
public String MyMethod(String name)
{
return "The client requests to "+name;
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
using System;

public class MyServerImpl :MarshalByRefObject
public class MyServerImpl :MarshalByRefObject
{
int i;
public MyServerImpl()
Expand All @@ -9,7 +9,7 @@ public MyServerImpl()
Console.WriteLine("Server Activated...");
}

public String MyMethod(String name)
public String MyMethod(String name)
{
i=i+1;
return "The client requests to "+name +i+" time";
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@

public class MyServerImpl :MarshalByRefObject
{
public MyServerImpl()
public MyServerImpl()
{
Console.WriteLine("Server Activated");
}

public String MyMethod(String name)
public String MyMethod(String name)
{
return "The string from client is " + name;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,12 @@

public class MyServerImpl :MarshalByRefObject
{
public MyServerImpl()
public MyServerImpl()
{
Console.WriteLine("Server Activated");
}

public String MyMethod(String name)
public String MyMethod(String name)
{
Console.WriteLine(name);
return "The string from server : " + name;
Expand Down
2 changes: 1 addition & 1 deletion samples/snippets/csharp/System.DateTime/Calendar.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ private static void CalculateWeeks()
// Date : 18/8/1395
// Day of Week: Sunday
// Week of year: 34
//
//
// Using the Gregorian calendar
// Date : 18/08/0852
// Day of Week: Sunday
Expand Down
4 changes: 2 additions & 2 deletions samples/snippets/csharp/System.DateTime/Parsing.cs
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ public static void Snippets()
private static void ParseStandardFormats()
{
// <Snippet1>
System.Threading.Thread.CurrentThread.CurrentCulture =
System.Threading.Thread.CurrentThread.CurrentCulture =
System.Globalization.CultureInfo.CreateSpecificCulture("en-GB");

var date1 = new DateTime(2013, 6, 1, 12, 32, 30);
Expand Down Expand Up @@ -73,7 +73,7 @@ private static void ParseISO8601()
{
// <Snippet3>
var iso8601String = "20080501T08:30:52Z";
DateTime dateISO8602 = DateTime.ParseExact(iso8601String, "yyyyMMddTHH:mm:ssZ",
DateTime dateISO8602 = DateTime.ParseExact(iso8601String, "yyyyMMddTHH:mm:ssZ",
System.Globalization.CultureInfo.InvariantCulture);
Console.WriteLine($"{iso8601String} --> {dateISO8602:g}");
// </Snippet3>
Expand Down
4 changes: 2 additions & 2 deletions samples/snippets/csharp/System.DateTime/StringFormat.cs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ private static void ShowCultureSpecificFullDateAndTime()
var date1 = new DateTime(2008, 3, 1, 7, 0, 0);
Console.WriteLine(date1.ToString("F", new System.Globalization.CultureInfo("fr-FR")));
// Displays samedi 1 mars 2008 07:00:00
// </Snippet4>
// </Snippet4>
}

private static void ShowIso8601Format()
Expand All @@ -55,7 +55,7 @@ private static void ShowIso8601Format()
var date1 = new DateTime(2008, 3, 1, 7, 0, 0);
Console.WriteLine(date1.ToString("yyyyMMddTHH:mm:ssZ"));
// Displays 20080301T07:00:00Z
// </Snippet5>
// </Snippet5>
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,30 +14,30 @@ private void GetConstraints(DataTable dataTable)
// Print the table's name.
Console.WriteLine("TableName: " + dataTable.TableName);

// Iterate through the collection and
// Iterate through the collection and
// print each name and type value.
foreach(Constraint constraint in dataTable.Constraints )
foreach(Constraint constraint in dataTable.Constraints )
{
Console.WriteLine("Constraint Name: "
Console.WriteLine("Constraint Name: "
+ constraint.ConstraintName);
Console.WriteLine("Type: "
Console.WriteLine("Type: "
+ constraint.GetType().ToString());

// If the constraint is a UniqueConstraint,
// If the constraint is a UniqueConstraint,
// print its properties using a function below.
if(constraint is UniqueConstraint)
if(constraint is UniqueConstraint)
{
PrintUniqueConstraintProperties(constraint);
}
// If the constraint is a ForeignKeyConstraint,
// If the constraint is a ForeignKeyConstraint,
// print its properties using a function below.
if(constraint is ForeignKeyConstraint)
if(constraint is ForeignKeyConstraint)
{
PrintForeigKeyConstraintProperties(constraint);
}
}
}

private void PrintUniqueConstraintProperties(
Constraint constraint)
{
Expand All @@ -49,36 +49,36 @@ private void PrintUniqueConstraintProperties(
columnArray = uniqueConstraint.Columns;

// Print each column's name.
for(int i = 0;i<columnArray.Length ;i++)
for(int i = 0;i<columnArray.Length ;i++)
{
Console.WriteLine("Column Name: "
Console.WriteLine("Column Name: "
+ columnArray[i].ColumnName);
}
}

private void PrintForeigKeyConstraintProperties(
Constraint constraint)
{
ForeignKeyConstraint fkConstraint;
fkConstraint = (ForeignKeyConstraint) constraint;

// Get the Columns as an array.
DataColumn[] columnArray;
columnArray = fkConstraint.Columns;

// Print each column's name.
for(int i = 0;i<columnArray.Length ;i++)
for(int i = 0;i<columnArray.Length ;i++)
{
Console.WriteLine("Column Name: "
Console.WriteLine("Column Name: "
+ columnArray[i].ColumnName);
}
Console.WriteLine();

// Get the related columns and print each columns name.
columnArray = fkConstraint.RelatedColumns ;
for(int i = 0;i<columnArray.Length ;i++)
for(int i = 0;i<columnArray.Length ;i++)
{
Console.WriteLine("Related Column Name: "
Console.WriteLine("Related Column Name: "
+ columnArray[i].ColumnName);
}
Console.WriteLine();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ private void MakeTableWithUniqueConstraint()
table.Columns.Add(column);

// Print count, name, and type.
Console.WriteLine("Constraints.Count "
Console.WriteLine("Constraints.Count "
+ table.Constraints.Count);
Console.WriteLine(table.Constraints[0].ConstraintName);
Console.WriteLine(table.Constraints[0].GetType() );
Expand All @@ -26,12 +26,12 @@ private void MakeTableWithUniqueConstraint()
table.Columns.Add(column);

// Print info again.
Console.WriteLine("Constraints.Count "
Console.WriteLine("Constraints.Count "
+ table.Constraints.Count);
Console.WriteLine(table.Constraints[1].ConstraintName);
Console.WriteLine(table.Constraints[1].GetType() );
}

private void MakeTableWithForeignConstraint()
{
// Create a DataSet.
Expand All @@ -46,32 +46,32 @@ private void MakeTableWithForeignConstraint()
DataColumn id = new DataColumn("ID");
DataColumn orderId = new DataColumn("OrderID");
DataColumn cDate = new DataColumn("OrderDate");

// Add columns to tables.
customersTable.Columns.Add(name);
customersTable.Columns.Add(id);
ordersTable.Columns.Add(orderId);
ordersTable.Columns.Add(cDate);

// Add tables to the DataSet.
dataSet.Tables.Add(customersTable);
dataSet.Tables.Add(ordersTable);
dataSet.Tables.Add(ordersTable);

// Create a DataRelation for two of the columns.
DataRelation myRelation = new
DataRelation myRelation = new
DataRelation("CustomersOrders",id,orderId,true);
dataSet.Relations.Add(myRelation);

// Print TableName, Constraints.Count,
// Print TableName, Constraints.Count,
// ConstraintName and Type.
foreach(DataTable t in dataSet.Tables)
{
Console.WriteLine(t.TableName);
Console.WriteLine("Constraints.Count "
Console.WriteLine("Constraints.Count "
+ t.Constraints.Count);
Console.WriteLine("ParentRelations.Count "
Console.WriteLine("ParentRelations.Count "
+ t.ParentRelations.Count);
Console.WriteLine("ChildRelations.Count "
Console.WriteLine("ChildRelations.Count "
+ t.ChildRelations.Count);
foreach(Constraint cstrnt in t.Constraints)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ public class Form1: Form
private void AddConstraint(DataTable table)
{
UniqueConstraint uniqueConstraint;
// Assuming a column named "UniqueColumn" exists, and
// Assuming a column named "UniqueColumn" exists, and
// its Unique property is true.
uniqueConstraint = new UniqueConstraint(
table.Columns["UniqueColumn"]);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,18 +10,18 @@ private void AddForeignConstraint(DataSet dataSet)
{
try
{
DataColumn parentColumn =
DataColumn parentColumn =
dataSet.Tables["Suppliers"].Columns["SupplierID"];
DataColumn childColumn =
DataColumn childColumn =
dataSet.Tables["Products"].Columns["SupplierID"];
dataSet.Tables["Products"].Constraints.Add
("ProductsSuppliers", parentColumn, childColumn);
}
catch(Exception ex)
{
// In case the constraint already exists,
// In case the constraint already exists,
// catch the collision here and respond.
Console.WriteLine("Exception of type {0} occurred.",
Console.WriteLine("Exception of type {0} occurred.",
ex.GetType());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,22 +17,22 @@ private void AddForeignConstraint(
// Get the tables from the DataSet.
DataTable customersTable = dataSet.Tables["Customers"];
DataTable ordersTable = dataSet.Tables["Orders"];

// Set Columns.
parentColumns[0]=customersTable.Columns["id"];
parentColumns[1]=customersTable.Columns["Name"];
childColumns[0] = ordersTable.Columns["CustomerID"];
childColumns[1] = ordersTable.Columns["CustomerName"];

// Create ForeignKeyConstraint
table.Constraints.Add("CustOrdersConstraint",
parentColumns, childColumns);
}
catch(Exception ex)
{
// In case the constraint already exists,
// In case the constraint already exists,
// catch the collision here and respond.
Console.WriteLine("Exception of type {0} occurred.",
Console.WriteLine("Exception of type {0} occurred.",
ex.GetType());
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,21 +14,21 @@ public static void ConstraintAddRange(DataSet dataSet)
DataTable ordersTable = dataSet.Tables["Orders"];

// Create unique and foreign key constraints.
UniqueConstraint uniqueConstraint = new
UniqueConstraint uniqueConstraint = new
UniqueConstraint(customersTable.Columns["CustomerID"]);
ForeignKeyConstraint fkConstraint = new
ForeignKeyConstraint fkConstraint = new
ForeignKeyConstraint("CustOrdersConstraint",
customersTable.Columns["CustomerID"],
ordersTable.Columns["CustomerID"]);

// Add the constraints.
customersTable.Constraints.AddRange(new Constraint[]
customersTable.Constraints.AddRange(new Constraint[]
{uniqueConstraint, fkConstraint});
}
catch(Exception ex)
{
// Process exception and return.
Console.WriteLine("Exception of type {0} occurred.",
Console.WriteLine("Exception of type {0} occurred.",
ex.GetType());
}
}
Expand Down
Loading