Skip to content

Names -> Keywords batch 13 #6976

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
@@ -1,11 +1,11 @@
using System;
using System;
using System.Collections;

public class ShortStringDictionary : DictionaryBase {

public String this[ String key ] {
public string this[ string key ] {
get {
return( (String) Dictionary[key] );
return( (string) Dictionary[key] );
}
set {
Dictionary[key] = value;
Expand All @@ -24,35 +24,35 @@ public ICollection Values {
}
}

public void Add( String key, String value ) {
public void Add( string key, string value ) {
Dictionary.Add( key, value );
}

public bool Contains( String key ) {
public bool Contains( string key ) {
return( Dictionary.Contains( key ) );
}

public void Remove( String key ) {
public void Remove( string key ) {
Dictionary.Remove( key );
}

protected override void OnInsert( Object key, Object value ) {
if ( key.GetType() != typeof(System.String) )
{
throw new ArgumentException( "key must be of type String.", "key" );
throw new ArgumentException( "key must be of type string.", "key" );
}
else {
String strKey = (String) key;
string strKey = (string) key;
if ( strKey.Length > 5 )
throw new ArgumentException( "key must be no more than 5 characters in length.", "key" );
}

if ( value.GetType() != typeof(System.String) )
{
throw new ArgumentException( "value must be of type String.", "value" );
throw new ArgumentException( "value must be of type string.", "value" );
}
else {
String strValue = (String) value;
string strValue = (string) value;
if ( strValue.Length > 5 )
throw new ArgumentException( "value must be no more than 5 characters in length.", "value" );
}
Expand All @@ -61,10 +61,10 @@ protected override void OnInsert( Object key, Object value ) {
protected override void OnRemove( Object key, Object value ) {
if ( key.GetType() != typeof(System.String) )
{
throw new ArgumentException( "key must be of type String.", "key" );
throw new ArgumentException( "key must be of type string.", "key" );
}
else {
String strKey = (String) key;
string strKey = (string) key;
if ( strKey.Length > 5 )
throw new ArgumentException( "key must be no more than 5 characters in length.", "key" );
}
Expand All @@ -73,20 +73,20 @@ protected override void OnRemove( Object key, Object value ) {
protected override void OnSet( Object key, Object oldValue, Object newValue ) {
if ( key.GetType() != typeof(System.String) )
{
throw new ArgumentException( "key must be of type String.", "key" );
throw new ArgumentException( "key must be of type string.", "key" );
}
else {
String strKey = (String) key;
string strKey = (string) key;
if ( strKey.Length > 5 )
throw new ArgumentException( "key must be no more than 5 characters in length.", "key" );
}

if ( newValue.GetType() != typeof(System.String) )
{
throw new ArgumentException( "newValue must be of type String.", "newValue" );
throw new ArgumentException( "newValue must be of type string.", "newValue" );
}
else {
String strValue = (String) newValue;
string strValue = (string) newValue;
if ( strValue.Length > 5 )
throw new ArgumentException( "newValue must be no more than 5 characters in length.", "newValue" );
}
Expand All @@ -95,20 +95,20 @@ protected override void OnSet( Object key, Object oldValue, Object newValue ) {
protected override void OnValidate( Object key, Object value ) {
if ( key.GetType() != typeof(System.String) )
{
throw new ArgumentException( "key must be of type String.", "key" );
throw new ArgumentException( "key must be of type string.", "key" );
}
else {
String strKey = (String) key;
string strKey = (string) key;
if ( strKey.Length > 5 )
throw new ArgumentException( "key must be no more than 5 characters in length.", "key" );
}

if ( value.GetType() != typeof(System.String) )
{
throw new ArgumentException( "value must be of type String.", "value" );
throw new ArgumentException( "value must be of type string.", "value" );
}
else {
String strValue = (String) value;
string strValue = (string) value;
if ( strValue.Length > 5 )
throw new ArgumentException( "value must be no more than 5 characters in length.", "value" );
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
// <Snippet1>
// <Snippet1>
using System;
using System.Collections.Generic;

class Program
{
static Dictionary<Box, String> boxes;
static Dictionary<Box, string> boxes;

static void Main()
{
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
//<snippet1>
//<snippet1>
using System;
using System.IO;
using System.Collections;
Expand All @@ -20,7 +20,7 @@ public static void TestStreamReaderEnumerable()
{
// Check the memory before the iterator is used.
long memoryBefore = GC.GetTotalMemory(true);
IEnumerable<String> stringsFound;
IEnumerable<string> stringsFound;
// Open a file with the StreamReaderEnumerable and check for a string.
try {
stringsFound =
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// <Snippet1>
// <Snippet1>
using System;
using System.Collections.Generic;

Expand All @@ -24,7 +24,7 @@ static void Main()
boxes.Count);
}

private static void AddBox(Dictionary<Box, String> dict, Box box, String name)
private static void AddBox(Dictionary<Box, string> dict, Box box, string name)
{
try {
dict.Add(box, name);
Expand All @@ -48,9 +48,9 @@ public Box(int h, int l, int w)
public int Length { get; set; }
public int Width { get; set; }

public override String ToString()
public override string ToString()
{
return String.Format("({0}, {1}, {2})", Height, Length, Width);
return string.Format("({0}, {1}, {2})", Height, Length, Width);
}
}

Expand Down