Skip to content

Commit 0e26ec2

Browse files
lucasnobredevRon Petrusha
authored andcommitted
Fix strings with s uppercase (#426)
* remove of condition unecessary * fix strings with s uppercase * put again condition with discard
1 parent 37a489b commit 0e26ec2

File tree

4 files changed

+28
-28
lines changed

4 files changed

+28
-28
lines changed

snippets/csharp/VS_Snippets_CLR_System/system.object.tostring/cs/customize1.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@ public CList(IEnumerable<T> collection) : base(collection)
1010
public CList() : base()
1111
{}
1212

13-
public override String ToString()
13+
public override string ToString()
1414
{
15-
String retVal = String.Empty;
15+
string retVal = string.Empty;
1616
foreach (T item in this) {
17-
if (String.IsNullOrEmpty(retVal))
17+
if (string.IsNullOrEmpty(retVal))
1818
retVal += item.ToString();
1919
else
20-
retVal += String.Format(", {0}", item);
20+
retVal += string.Format(", {0}", item);
2121
}
2222
return retVal;
2323
}

snippets/csharp/VS_Snippets_CLR_System/system.object.tostring/cs/customize2.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,29 +4,29 @@
44

55
public static class StringExtensions
66
{
7-
public static String ToString2<T>(this List<T> l)
7+
public static string ToString2<T>(this List<T> l)
88
{
9-
String retVal = String.Empty;
9+
string retVal = string.Empty;
1010
foreach (T item in l)
11-
retVal += String.Format("{0}{1}", String.IsNullOrEmpty(retVal) ?
11+
retVal += string.Format("{0}{1}", string.IsNullOrEmpty(retVal) ?
1212
"" : ", ",
1313
item);
14-
return String.IsNullOrEmpty(retVal) ? "{}" : "{ " + retVal + " }";
14+
return string.IsNullOrEmpty(retVal) ? "{}" : "{ " + retVal + " }";
1515
}
1616

17-
public static String ToString<T>(this List<T> l, String fmt)
17+
public static string ToString<T>(this List<T> l, string fmt)
1818
{
19-
String retVal = String.Empty;
19+
string retVal = string.Empty;
2020
foreach (T item in l) {
2121
IFormattable ifmt = item as IFormattable;
2222
if (ifmt != null)
23-
retVal += String.Format("{0}{1}",
24-
String.IsNullOrEmpty(retVal) ?
23+
retVal += string.Format("{0}{1}",
24+
string.IsNullOrEmpty(retVal) ?
2525
"" : ", ", ifmt.ToString(fmt, null));
2626
else
2727
retVal += ToString2(l);
2828
}
29-
return String.IsNullOrEmpty(retVal) ? "{}" : "{ " + retVal + " }";
29+
return string.IsNullOrEmpty(retVal) ? "{}" : "{ " + retVal + " }";
3030
}
3131
}
3232

snippets/csharp/VS_Snippets_CLR_System/system.object.tostring/cs/tostringoverload1.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,12 @@
44
public class Automobile
55
{
66
private int _doors;
7-
private String _cylinders;
7+
private string _cylinders;
88
private int _year;
9-
private String _model;
9+
private string _model;
1010

11-
public Automobile(String model, int year , int doors,
12-
String cylinders)
11+
public Automobile(string model, int year , int doors,
12+
string cylinders)
1313
{
1414
_model = model;
1515
_year = year;
@@ -20,40 +20,40 @@ public Automobile(String model, int year , int doors,
2020
public int Doors
2121
{ get { return _doors; } }
2222

23-
public String Model
23+
public string Model
2424
{ get { return _model; } }
2525

2626
public int Year
2727
{ get { return _year; } }
2828

29-
public String Cylinders
29+
public string Cylinders
3030
{ get { return _cylinders; } }
3131

32-
public override String ToString()
32+
public override string ToString()
3333
{
3434
return ToString("G");
3535
}
3636

37-
public String ToString(String fmt)
37+
public string ToString(string fmt)
3838
{
39-
if (String.IsNullOrEmpty(fmt))
39+
if (string.IsNullOrEmpty(fmt))
4040
fmt = "G";
4141

4242
switch (fmt.ToUpperInvariant())
4343
{
4444
case "G":
45-
return String.Format("{0} {1}", _year, _model);
45+
return string.Format("{0} {1}", _year, _model);
4646
case "D":
47-
return String.Format("{0} {1}, {2} dr.",
47+
return string.Format("{0} {1}, {2} dr.",
4848
_year, _model, _doors);
4949
case "C":
50-
return String.Format("{0} {1}, {2}",
50+
return string.Format("{0} {1}, {2}",
5151
_year, _model, _cylinders);
5252
case "A":
53-
return String.Format("{0} {1}, {2} dr. {3}",
53+
return string.Format("{0} {1}, {2} dr. {3}",
5454
_year, _model, _doors, _cylinders);
5555
default:
56-
String msg = String.Format("'{0}' is an invalid format string",
56+
string msg = string.Format("'{0}' is an invalid format string",
5757
fmt);
5858
throw new ArgumentException(msg);
5959
}

snippets/csharp/VS_Snippets_CLR_System/system.object.tostring/cs/tostringoverload2.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ public class Example
66
{
77
public static void Main()
88
{
9-
String[] cultureNames = { "en-US", "en-GB", "fr-FR",
9+
string[] cultureNames = { "en-US", "en-GB", "fr-FR",
1010
"hr-HR", "ja-JP" };
1111
Decimal value = 1603.49m;
1212
foreach (var cultureName in cultureNames) {

0 commit comments

Comments
 (0)