Skip to content

Names -> Keywords batch 10 #6973

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

Closed
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
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
<Project Sdk="Microsoft.NET.Sdk">

<PropertyGroup>
<OutputType>Exe</OutputType>
<TargetFramework>net5</TargetFramework>
<LangVersion>9.0</LangVersion>
<StartupObject>buffer</StartupObject>
<AllowUnsafeBlocks>true</AllowUnsafeBlocks>
<Platforms>AnyCPU;x86</Platforms>
</PropertyGroup>

<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|AnyCPU'">
<DocumentationFile></DocumentationFile>
</PropertyGroup>

</Project>

























Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <Snippet2>
// <Snippet2>
using System;

class Example
Expand Down Expand Up @@ -27,7 +27,7 @@ public static void DisplayArrayValues(Array arr, string name)
{
// Get the length of one element in the array.
int elementLength = Buffer.ByteLength(arr) / arr.Length;
string formatString = String.Format(" {{0:X{0}}}", 2 * elementLength);
string formatString = string.Format(" {{0:X{0}}}", 2 * elementLength);
Console.Write( "{0,11}:", name);
for (int ctr = 0; ctr < arr.Length; ctr++)
Console.Write(formatString, arr.GetValue(ctr));
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//<Snippet3>
//<Snippet3>
// Example of the Buffer.GetByte method.
using System;

Expand All @@ -11,7 +11,7 @@ public static void DisplayArray( Array arr, string name )
{
// Get the array element width; format the formatting string.
int elemWidth = Buffer.ByteLength( arr ) / arr.Length;
string format = String.Format( " {{0:X{0}}}", 2 * elemWidth );
string format = string.Format( " {{0:X{0}}}", 2 * elemWidth );

// Display the array elements from right to left.
Console.Write( "{0,5}:", name );
Expand All @@ -26,7 +26,7 @@ public static void ArrayInfo( Array arr, string name, int index )

// Display the array name, index, and byte to be viewed.
Console.WriteLine( formatter, name, index, value,
String.Format( "0x{0:X2}", value ) );
string.Format( "0x{0:X2}", value ) );
}

public static void Main( )
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//<Snippet2>
//<Snippet2>
// Example of the Buffer.SetByte method.
using System;

Expand All @@ -9,7 +9,7 @@ public static void DisplayArray( Array arr, string name )
{
// Get the array element width; format the formatting string.
int elemWidth = Buffer.ByteLength( arr ) / arr.Length;
string format = String.Format( " {{0:X{0}}}", 2 * elemWidth );
string format = string.Format( " {{0:X{0}}}", 2 * elemWidth );

// Display the array elements from right to left.
Console.Write( "{0,7}:", name );
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
using System;
using System;

namespace SystemByte_Examples
{
Expand All @@ -12,7 +12,7 @@ static void Main(string[] args)
SystemByteExamples sbe = new SystemByteExamples();
int numberToSet;
Byte compareByte;
// String stringToConvert;
// string stringToConvert;

numberToSet = 120;
// stringToConvert = "200";
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//<Snippet1>
//<Snippet1>
// Example for the Byte.ToString( ) methods.
using System;
using System.Globalization;
Expand Down Expand Up @@ -48,9 +48,9 @@ static void Main( )
{
Console.WriteLine( "This example of\n" +
" Byte.ToString( ),\n" +
" Byte.ToString( String ),\n" +
" Byte.ToString( string ),\n" +
" Byte.ToString( IFormatProvider ), and\n" +
" Byte.ToString( String, IFormatProvider )\n" +
" Byte.ToString( string, IFormatProvider )\n" +
"generates the following output when formatting " +
"Byte values \nwith combinations of format " +
"strings and IFormatProvider." );
Expand All @@ -62,9 +62,9 @@ static void Main( )
/*
This example of
Byte.ToString( ),
Byte.ToString( String ),
Byte.ToString( string ),
Byte.ToString( IFormatProvider ), and
Byte.ToString( String, IFormatProvider )
Byte.ToString( string, IFormatProvider )
generates the following output when formatting Byte values
with combinations of format strings and IFormatProvider.

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <snippet23>
// <snippet23>
using System;

public class CharStructureSample
Expand All @@ -11,18 +11,18 @@ public static void Main()

Console.WriteLine(chA.CompareTo('B')); //----------- Output: "-1" (meaning 'A' is 1 less than 'B')
Console.WriteLine(chA.Equals('A')); //----------- Output: "True"
Console.WriteLine(Char.GetNumericValue(ch1)); //----------- Output: "1"
Console.WriteLine(Char.IsControl('\t')); //----------- Output: "True"
Console.WriteLine(Char.IsDigit(ch1)); //----------- Output: "True"
Console.WriteLine(Char.IsLetter(',')); //----------- Output: "False"
Console.WriteLine(Char.IsLower('u')); //----------- Output: "True"
Console.WriteLine(Char.IsNumber(ch1)); //----------- Output: "True"
Console.WriteLine(Char.IsPunctuation('.')); //----------- Output: "True"
Console.WriteLine(Char.IsSeparator(str, 4)); //----------- Output: "True"
Console.WriteLine(Char.IsSymbol('+')); //----------- Output: "True"
Console.WriteLine(Char.IsWhiteSpace(str, 4)); //----------- Output: "True"
Console.WriteLine(Char.Parse("S")); //----------- Output: "S"
Console.WriteLine(Char.ToLower('M')); //----------- Output: "m"
Console.WriteLine(char.GetNumericValue(ch1)); //----------- Output: "1"
Console.WriteLine(char.IsControl('\t')); //----------- Output: "True"
Console.WriteLine(char.IsDigit(ch1)); //----------- Output: "True"
Console.WriteLine(char.IsLetter(',')); //----------- Output: "False"
Console.WriteLine(char.IsLower('u')); //----------- Output: "True"
Console.WriteLine(char.IsNumber(ch1)); //----------- Output: "True"
Console.WriteLine(char.IsPunctuation('.')); //----------- Output: "True"
Console.WriteLine(char.IsSeparator(str, 4)); //----------- Output: "True"
Console.WriteLine(char.IsSymbol('+')); //----------- Output: "True"
Console.WriteLine(char.IsWhiteSpace(str, 4)); //----------- Output: "True"
Console.WriteLine(char.Parse("S")); //----------- Output: "S"
Console.WriteLine(char.ToLower('M')); //----------- Output: "m"
Console.WriteLine('x'.ToString()); //----------- Output: "x"
}
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <Snippet10>
// <Snippet10>
using System;
using System.IO;
using System.Threading;
Expand All @@ -10,15 +10,15 @@ public static void Main()
// Initialize flag variables.
bool isRedirected = false;
bool isBoth = false;
String fileName = "";
string fileName = "";
StreamWriter sw = null;

// Get any command line arguments.
String[] args = Environment.GetCommandLineArgs();
// Handle any arguments.
if (args.Length > 1) {
for (int ctr = 1; ctr < args.Length; ctr++) {
String arg = args[ctr];
string arg = args[ctr];
if (arg.StartsWith("/") || arg.StartsWith("-")) {
switch (arg.Substring(1).ToLower())
{
Expand All @@ -35,7 +35,7 @@ public static void Main()
isBoth = true;
break;
default:
ShowSyntax(String.Format("The {0} switch is not supported",
ShowSyntax(string.Format("The {0} switch is not supported",
args[ctr]));
return;
}
Expand All @@ -55,17 +55,17 @@ public static void Main()
if (!isBoth)
Console.SetOut(sw);
}
String msg = String.Format("Application began at {0}", DateTime.Now);
string msg = string.Format("Application began at {0}", DateTime.Now);
Console.WriteLine(msg);
if (isBoth) sw.WriteLine(msg);
Thread.Sleep(5000);
msg = String.Format("Application ended normally at {0}", DateTime.Now);
msg = string.Format("Application ended normally at {0}", DateTime.Now);
Console.WriteLine(msg);
if (isBoth) sw.WriteLine(msg);
if (isRedirected) sw.Close();
}

private static void ShowSyntax(String errMsg)
private static void ShowSyntax(string errMsg)
{
Console.WriteLine(errMsg);
Console.WriteLine("\nSyntax: Example [[/f <filename> [/b]]\n");
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// <Snippet2>
// <Snippet2>
using System;

public class Example
{
public static void Main()
{
string[] values = { null, String.Empty, "True", "False",
string[] values = { null, string.Empty, "True", "False",
"true", "false", " true ",
"TrUe", "fAlSe", "fa lse", "0",
"1", "-1", "string" };
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <Snippet9>
// <Snippet9>
using System;

public class Example
Expand All @@ -9,7 +9,7 @@ public static void Main()
foreach (var value in values) {
bool success, result;
int number;
success = Int32.TryParse(value, out number);
success = int.TryParse(value, out number);
if (success) {
// The method throws no exceptions.
result = Convert.ToBoolean(number);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// <Snippet1>
// <Snippet1>
using System;

public class Example
{
public static void Main()
{
string[] values = { null, String.Empty, "True", "False",
string[] values = { null, string.Empty, "True", "False",
"true", "false", " true ", "0",
"1", "-1", "string" };
foreach (var value in values) {
Expand Down