Skip to content

Commit

Permalink
Normalize trailing spaces (#2815)
Browse files Browse the repository at this point in the history
  • Loading branch information
nxtn authored Apr 21, 2020
1 parent 34d0846 commit f7e66bf
Show file tree
Hide file tree
Showing 200 changed files with 1,257 additions and 1,257 deletions.
6 changes: 3 additions & 3 deletions async/async-and-await/cs/MainWindow.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -24,12 +24,12 @@ private async void StartButton_Click(object sender, RoutedEventArgs e)
}

// Three things to note in the signature:
// - The method has an async modifier.
// - The method has an async modifier.
// - The return type is Task or Task<T>. (See "Return Types" section.)
// Here, it is Task<int> because the return statement returns an integer.
// - The method name ends in "Async."
async Task<int> AccessTheWebAsync()
{
{
// You need to add a reference to System.Net.Http to declare client.
var client = new HttpClient();

Expand All @@ -43,7 +43,7 @@ async Task<int> AccessTheWebAsync()
// The await operator suspends AccessTheWebAsync.
// - AccessTheWebAsync can't continue until getStringTask is complete.
// - Meanwhile, control returns to the caller of AccessTheWebAsync.
// - Control resumes here when getStringTask is complete.
// - Control resumes here when getStringTask is complete.
// - The await operator then retrieves the string result from getStringTask.
string urlContents = await getStringTask;

Expand Down
8 changes: 4 additions & 4 deletions async/async-and-await/vb/MainWindow.xaml.vb
Original file line number Diff line number Diff line change
Expand Up @@ -23,21 +23,21 @@ Class MainWindow


' Three things to note about writing an Async Function:
' - The function has an Async modifier.
' - The function has an Async modifier.
' - Its return type is Task or Task(Of T). (See "Return Types" section.)
' - As a matter of convention, its name ends in "Async".
Async Function AccessTheWebAsync() As Task(Of Integer)

Using client As New HttpClient()

' Call and await separately.
' Call and await separately.
' - AccessTheWebAsync can do other things while GetStringAsync is also running.
' - getStringTask stores the task we get from the call to GetStringAsync.
' - getStringTask stores the task we get from the call to GetStringAsync.
' - Task(Of String) means it is a task which returns a String when it is done.
Dim getStringTask As Task(Of String) =
client.GetStringAsync("https://docs.microsoft.com/dotnet")

' You can do other work here that doesn't rely on the string from GetStringAsync.
' You can do other work here that doesn't rely on the string from GetStringAsync.
DoIndependentWork()

' The Await operator suspends AccessTheWebAsync.
Expand Down
2 changes: 1 addition & 1 deletion core/assembly/MetadataLoadContext/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ namespace MetadataLoadContextSample
class Program
{
static int Main(string[] args)
{
{
if (args.Length < 1)
{
Console.WriteLine("Usage: dotnet MetadataLoadContextSample.dll <assembly path>");
Expand Down
4 changes: 2 additions & 2 deletions core/console-apps/NewTypesMsBuild/src/NewTypes/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ public static void Main(string[] args)
List<IPet> pets = new List<IPet>
{
new Dog(),
new Cat()
new Cat()
};

foreach (var pet in pets)
{
Console.WriteLine(pet.TalkToOwner());
Expand Down
20 changes: 10 additions & 10 deletions core/encoding/cyrillic-to-latin/cs/ConsoleModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@ class ConsoleModule
static void Main()
{
string[] args = Environment.GetCommandLineArgs();

// Get command line arguments.
if (args.Length != 3 || String.IsNullOrWhiteSpace(args[1]) || String.IsNullOrWhiteSpace(args[2]))
{
Console.WriteLine("There must be a source and a destination file.");
Console.WriteLine("There must be a source and a destination file.");
ShowSyntax();
return;
}
Expand All @@ -27,15 +27,15 @@ static void Main()

try
{
using (var sr = new StreamReader(source))
using (var sr = new StreamReader(source))
{
// Check whether destination file exists and exit if it should not be overwritten.
if (File.Exists(destination))
if (File.Exists(destination))
{
Console.Write("The destination file {1} '{0}'{1}exists. Overwrite it? (Y/N) ",
Console.Write("The destination file {1} '{0}'{1}exists. Overwrite it? (Y/N) ",
source, Environment.NewLine);
ConsoleKeyInfo keyPressed = Console.ReadKey(true);
if (Char.ToUpper(keyPressed.KeyChar) == 'Y' | Char.ToUpper(keyPressed.KeyChar) == 'N')
if (Char.ToUpper(keyPressed.KeyChar) == 'Y' | Char.ToUpper(keyPressed.KeyChar) == 'N')
{
Console.WriteLine(keyPressed.KeyChar);
if (Char.ToUpper(keyPressed.KeyChar) == 'N')
Expand All @@ -52,9 +52,9 @@ static void Main()

// Define buffer to read characters
char[] buffer = new char[100];
int charsRead;
int charsRead;

do
do
{
// Read next 100 characters from input stream.
charsRead = sr.ReadBlock(buffer, 0, buffer.Length);
Expand All @@ -72,12 +72,12 @@ static void Main()
}
}
}
catch (DirectoryNotFoundException e)
catch (DirectoryNotFoundException e)
{
Console.WriteLine($"Invalid directory: {e.Message}");
return;
}
catch (IOException e)
catch (IOException e)
{
Console.WriteLine($"I/O exception: {e.Message}");
return;
Expand Down
18 changes: 9 additions & 9 deletions core/encoding/cyrillic-to-latin/cs/CyrillicToLatinFallback.cs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
using System.IO;
using System.Text;

class CyrillicToLatinFallback : EncoderFallback
class CyrillicToLatinFallback : EncoderFallback
{
private Dictionary<Char, String> table;
private Dictionary<Char, String> table;

public CyrillicToLatinFallback()
{
Expand Down Expand Up @@ -38,7 +38,7 @@ public CyrillicToLatinFallback()
table.Add('\u0427', "Ch");
table.Add('\u0428', "Sh");
table.Add('\u0429', "Shch");
table.Add('\u042A', "'"); // Hard sign
table.Add('\u042A', "'"); // Hard sign
table.Add('\u042B', "Ye");
table.Add('\u042C', "'"); // Soft sign
table.Add('\u042D', "E");
Expand Down Expand Up @@ -79,14 +79,14 @@ public CyrillicToLatinFallback()
table.Add('\u044F', "ia");
}

public override EncoderFallbackBuffer CreateFallbackBuffer()
public override EncoderFallbackBuffer CreateFallbackBuffer()
{
return new CyrillicToLatinFallbackBuffer(table);
}

public override int MaxCharCount
public override int MaxCharCount
{
get { return 4; } // Maximum is "Shch" and "shch"
get { return 4; } // Maximum is "Shch" and "shch"
}
}

Expand All @@ -112,7 +112,7 @@ public override bool Fallback(char charUnknownHigh, char charUnknownLow, int ind

public override bool Fallback(char charUnknown, int index)
{
if (charUnknown >= '\u0410' & charUnknown <= '\u044F')
if (charUnknown >= '\u0410' & charUnknown <= '\u044F')
{
buffer = table[charUnknown];
leftToReturn = buffer.Length - 1;
Expand All @@ -130,7 +130,7 @@ public override char GetNextChar()
bufferIndex++;
charToReturn = buffer[bufferIndex];
}
else
else
{
charToReturn = '\u0000';
}
Expand All @@ -139,7 +139,7 @@ public override char GetNextChar()

public override bool MovePrevious()
{
if (bufferIndex > 0)
if (bufferIndex > 0)
{
bufferIndex--;
leftToReturn++;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ Public Class CyrillicToLatinFallback : Inherits EncoderFallback
table.Add(ChrW(&H0427), "Ch")
table.Add(ChrW(&H0428), "Sh")
table.Add(ChrW(&H0429), "Shch")
table.Add(ChrW(&H042A), "'") ' Hard sign
table.Add(ChrW(&H042A), "'") ' Hard sign
table.Add(ChrW(&H042B), "Ye")
table.Add(ChrW(&H042C), "'") ' Soft sign
table.Add(ChrW(&H042D), "E")
Expand Down
2 changes: 1 addition & 1 deletion core/extensions/COMServerDemo/COMClient/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ static void Main(string[] args)
namespace Activation
{
/// <summary>
/// Managed definition of CoClass
/// Managed definition of CoClass
/// </summary>
[ComImport]
[CoClass(typeof(ServerClass))]
Expand Down
2 changes: 1 addition & 1 deletion core/extensions/DllMapDemo/NewLib.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
#define EXPORT extern "C" __attribute__((visibility("default")))
#elif defined(_MSC_VER)
#define EXPORT extern "C" __declspec(dllexport)
#endif
#endif

EXPORT int NativeSum(int a, int b)
{
Expand Down
4 changes: 2 additions & 2 deletions core/extensions/VisioDemo/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,9 @@ public static void Main(string[] args)

var endShp = vPag.DropConnected(processMst, nextShp, Visio.VisAutoConnectDir.visAutoConnectDirRight);
endShp.Text = "F";

//Set 'Parallel' theme
vPag.SetTheme(40);
vPag.SetTheme(40);
}
catch (Exception e)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@ public class PrimeService_IsPrimeShould
{
private readonly PrimeService _primeService;

public PrimeService_IsPrimeShould()
{
_primeService = new PrimeService();
}
public PrimeService_IsPrimeShould()
{
_primeService = new PrimeService();
}

#region Sample_TestCode
[Theory]
[InlineData(-1)]
Expand All @@ -21,33 +21,33 @@ public PrimeService_IsPrimeShould()
public void IsPrime_ValuesLessThan2_ReturnFalse(int value)
{
var result = _primeService.IsPrime(value);

Assert.False(result, $"{value} should not be prime");
}
#endregion
[Theory]
[InlineData(2)]
[InlineData(3)]
[InlineData(5)]
[InlineData(7)]
public void IsPrime_PrimesLessThan10_ReturnTrue(int value)
{
var result = _primeService.IsPrime(value);
Assert.True(result, $"{value} should be prime");
}
[Theory]
[InlineData(4)]
[InlineData(6)]
[InlineData(8)]
[InlineData(9)]
public void IsPrime_NonPrimesLessThan10_ReturnFalse(int value)
{
var result = _primeService.IsPrime(value);
Assert.False(result, $"{value} should not be prime");
}

[Theory]
[InlineData(2)]
[InlineData(3)]
[InlineData(5)]
[InlineData(7)]
public void IsPrime_PrimesLessThan10_ReturnTrue(int value)
{
var result = _primeService.IsPrime(value);

Assert.True(result, $"{value} should be prime");
}

[Theory]
[InlineData(4)]
[InlineData(6)]
[InlineData(8)]
[InlineData(9)]
public void IsPrime_NonPrimesLessThan10_ReturnFalse(int value)
{
var result = _primeService.IsPrime(value);

Assert.False(result, $"{value} should not be prime");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,21 +4,21 @@ namespace Prime.Services
{
public class PrimeService
{
public bool IsPrime(int candidate)
{
if (candidate < 2)
{
return false;
public bool IsPrime(int candidate)
{
if (candidate < 2)
{
return false;
}

for (var divisor = 2; divisor <= Math.Sqrt(candidate); divisor++)
{
if (candidate % divisor == 0)
{
return false;
}
}
return true;
}
for (var divisor = 2; divisor <= Math.Sqrt(candidate); divisor++)
{
if (candidate % divisor == 0)
{
return false;
}
}
return true;
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ namespace Prime.UnitTests.Services
public class PrimeService_IsPrimeShould
{
private readonly PrimeService _primeService;

public PrimeService_IsPrimeShould()
{
_primeService = new PrimeService();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,18 @@
<InlineData(7)>
Public Sub IsPrime_PrimesLessThan10_ReturnTrue(value As Integer)
Dim result As Boolean = _primeService.IsPrime(value)

Assert.True(result, $"{value} should be prime")
End Sub

<Theory>
<InlineData(4)>
<InlineData(6)>
<InlineData(8)>
<InlineData(9)>
<InlineData(8)>
<InlineData(9)>
Public Sub IsPrime_NonPrimesLessThan10_ReturnFalse(value As Integer)
Dim result As Boolean = _primeService.IsPrime(value)

Assert.False(result, $"{value} should not be prime")
End Sub
End Class
Expand Down
Loading

0 comments on commit f7e66bf

Please sign in to comment.