Skip to content

Commit bb7dd3c

Browse files
Names -> Keywords batch 2 (#6926)
* Names -> Keywords Replacing full type names with keywords when appropriate Files affected: sqlpersistenceproviderfactory.cs, mytokenauthenticator.cs, ioutlook.cs, snippets.cs, snippets1.cs, snippets24.cs, program.cs, program.cs, source.cs. See #6920 * Consistency in comments fixed
1 parent 69abc1b commit bb7dd3c

File tree

9 files changed

+43
-43
lines changed

9 files changed

+43
-43
lines changed

samples/snippets/csharp/VS_Snippets_CFX/sqlpersistenceproviderfactory/cs/sqlpersistenceproviderfactory.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Text;
44
using System.ServiceModel;
@@ -56,7 +56,7 @@ void Container4()
5656
//<snippet4>
5757
SqlPersistenceProviderFactory factory = new SqlPersistenceProviderFactory(
5858
DataBaseConstants.ConnectionString);
59-
String databaseConnectionString = factory.ConnectionString;
59+
string databaseConnectionString = factory.ConnectionString;
6060
//</snippet4>
6161
}
6262
void Container5()
@@ -93,7 +93,7 @@ void Container7()
9393

9494
class DataBaseConstants
9595
{
96-
public static String ConnectionString = "";
96+
public static string ConnectionString = "";
9797
}
9898
}
9999
}

samples/snippets/csharp/VS_Snippets_CFX/usernamesecuritytokenauthenticator/cs/mytokenauthenticator.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-

1+
22
// Copyright (c) Microsoft Corporation. All Rights Reserved.
33
// <snippet0>
44
using System;
@@ -66,7 +66,7 @@ protected override ReadOnlyCollection<IAuthorizationPolicy> ValidateUserNamePass
6666

6767
class UnconditionalPolicy : IAuthorizationPolicy
6868
{
69-
String id = Guid.NewGuid().ToString();
69+
string id = Guid.NewGuid().ToString();
7070
ClaimSet issuer;
7171
ClaimSet issuance;
7272
DateTime expirationTime;

samples/snippets/csharp/VS_Snippets_CFX/wf_samples/cs/ioutlook.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Text;
44

@@ -7,7 +7,7 @@ namespace Microsoft.Office.Core
77
//Hack: Skeleton of the interfaces that the code sample is looking for in the obsolete Outlook Interop Assembly...
88
public class Application
99
{
10-
public _MailItem CreateItem(String item)
10+
public _MailItem CreateItem(string item)
1111
{
1212
return new _MailItem();
1313
}

samples/snippets/csharp/VS_Snippets_CFX/wf_samples/cs/snippets.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-

1+
22
using System;
33

44
using System.Collections;
@@ -76,7 +76,7 @@ public void Container0()
7676
// Create a new Correlation Property object
7777
CorrelationProperty correlationProperty = new CorrelationProperty("taskName", "reportBalance");
7878
// Read the property name
79-
String taskName = correlationProperty.Name;
79+
string taskName = correlationProperty.Name;
8080
// Read the property value
8181
Object taskValue = correlationProperty.Value;
8282
//</snippet2>
@@ -838,9 +838,9 @@ private static string GetBaseIdentifier(Activity activity)
838838
StringBuilder b = new StringBuilder(baseIdentifier.Length);
839839
for (int i = 0; i < baseIdentifier.Length; i++)
840840
{
841-
if (Char.IsUpper(baseIdentifier[i]) && (i == 0 || i == baseIdentifier.Length - 1 || Char.IsUpper(baseIdentifier[i + 1])))
841+
if (char.IsUpper(baseIdentifier[i]) && (i == 0 || i == baseIdentifier.Length - 1 || char.IsUpper(baseIdentifier[i + 1])))
842842
{
843-
b.Append(Char.ToLower(baseIdentifier[i]));
843+
b.Append(char.ToLower(baseIdentifier[i]));
844844
}
845845
else
846846
{
@@ -1037,7 +1037,7 @@ public string XomlFile
10371037
{
10381038
get
10391039
{
1040-
return String.Empty;
1040+
return string.Empty;
10411041
}
10421042
set
10431043
{
@@ -1693,7 +1693,7 @@ private void DrawCustomActivity(ActivityDesignerPaintEventArgs e)
16931693

16941694
string text = this.Text;
16951695
Rectangle textRectangle = this.TextRectangle;
1696-
if (!String.IsNullOrEmpty(text) && !textRectangle.IsEmpty)
1696+
if (!string.IsNullOrEmpty(text) && !textRectangle.IsEmpty)
16971697
{
16981698
ActivityDesignerPaint.DrawText(graphics, compositeDesignerTheme.Font, text, textRectangle, StringAlignment.Center, e.AmbientTheme.TextQuality, compositeDesignerTheme.ForegroundBrush);
16991699
}

samples/snippets/csharp/VS_Snippets_CFX/wf_samples/cs/snippets1.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22

33
using System.Collections.ObjectModel;
44
using System.Workflow.Activities;
@@ -851,7 +851,7 @@ string IWorkflowCompilerOptionsService.RootNamespace
851851
{
852852
get
853853
{
854-
return String.Empty;
854+
return string.Empty;
855855
}
856856
}
857857
//</snippet122>

samples/snippets/csharp/VS_Snippets_CFX/wf_samples/cs/snippets24.cs

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
using System;
1+
using System;
22
using System.Collections.Generic;
33
using System.Text;
44
using System.Workflow.ComponentModel;
@@ -469,27 +469,27 @@ private void SendEmailUsingSmtp()
469469
message.To.Add(this.To);
470470

471471
// Assign the message values if they are valid.
472-
if (!String.IsNullOrEmpty(this.CC))
472+
if (!string.IsNullOrEmpty(this.CC))
473473
{
474474
message.CC.Add(this.CC);
475475
}
476476

477-
if (!String.IsNullOrEmpty(this.Bcc))
477+
if (!string.IsNullOrEmpty(this.Bcc))
478478
{
479479
message.Bcc.Add(this.Bcc);
480480
}
481481

482-
if (!String.IsNullOrEmpty(this.Subject))
482+
if (!string.IsNullOrEmpty(this.Subject))
483483
{
484484
message.Subject = this.Subject;
485485
}
486486

487-
if (!String.IsNullOrEmpty(this.Body))
487+
if (!string.IsNullOrEmpty(this.Body))
488488
{
489489
message.Body = this.Body;
490490
}
491491

492-
if (!String.IsNullOrEmpty(this.ReplyTo))
492+
if (!string.IsNullOrEmpty(this.ReplyTo))
493493
{
494494
message.ReplyTo = new MailAddress(this.ReplyTo);
495495
}
@@ -536,7 +536,7 @@ public override ValidationErrorCollection ValidateProperties(ValidationManager m
536536
private void ValidateEmailProperties(ValidationErrorCollection validationErrors, SendEmailActivity activity)
537537
{
538538
// Validate the To property
539-
if (String.IsNullOrEmpty(activity.To))
539+
if (string.IsNullOrEmpty(activity.To))
540540
{
541541
validationErrors.Add(ValidationError.GetNotSetValidationError(SendEmailActivity.ToProperty.Name));
542542
}
@@ -546,7 +546,7 @@ private void ValidateEmailProperties(ValidationErrorCollection validationErrors,
546546
}
547547

548548
// Validate the From property
549-
if (String.IsNullOrEmpty(activity.From))
549+
if (string.IsNullOrEmpty(activity.From))
550550
{
551551
validationErrors.Add(ValidationError.GetNotSetValidationError(SendEmailActivity.FromProperty.Name));
552552
}
@@ -560,7 +560,7 @@ private void ValidateEmailProperties(ValidationErrorCollection validationErrors,
560560
private void ValidateSMTPProperties(ValidationErrorCollection validationErrors, SendEmailActivity activity)
561561
{
562562
// Validate the SMTPHost property
563-
if (String.IsNullOrEmpty(activity.SmtpHost))
563+
if (string.IsNullOrEmpty(activity.SmtpHost))
564564
{
565565
validationErrors.Add(ValidationError.GetNotSetValidationError(SendEmailActivity.SmtpHostProperty.Name));
566566
}
@@ -848,7 +848,7 @@ class Snippets26
848848
{
849849
static void OnWorkflowIdle(object sender, WorkflowEventArgs e)
850850
{
851-
Int32 newAmount = 15000;
851+
int newAmount = 15000;
852852
WorkflowInstance workflowInstance = e.WorkflowInstance;
853853
// <snippet257>
854854
WorkflowChanges workflowchanges = new WorkflowChanges(workflowInstance.GetWorkflowDefinition());
@@ -1125,7 +1125,7 @@ protected override bool UnloadOnIdle(Activity activity)
11251125
// Serialize the activity instance state to file
11261126
private void SerializeToFile(byte[] workflowBytes, Guid id)
11271127
{
1128-
String filename = id.ToString();
1128+
string filename = id.ToString();
11291129
FileStream fileStream = null;
11301130
try
11311131
{
@@ -1147,7 +1147,7 @@ private void SerializeToFile(byte[] workflowBytes, Guid id)
11471147
// Deserialize the instance state from the file given the instance id
11481148
private byte[] DeserializeFromFile(Guid id)
11491149
{
1150-
String filename = id.ToString();
1150+
string filename = id.ToString();
11511151
FileStream fileStream = null;
11521152
try
11531153
{
@@ -1536,7 +1536,7 @@ private static void CreateAndInsertTrackingProfile()
15361536
TrackingProfileSerializer serializer = new TrackingProfileSerializer();
15371537
StringWriter writer = new StringWriter(new StringBuilder(), CultureInfo.InvariantCulture);
15381538
serializer.Serialize(writer, profile);
1539-
String trackingprofile = writer.ToString();
1539+
string trackingprofile = writer.ToString();
15401540
InsertTrackingProfile(trackingprofile);
15411541
}
15421542
// </snippet291>
@@ -1643,7 +1643,7 @@ class Snippets37
16431643
internal const string connectionString = "Initial Catalog=Tracking;Data Source=localhost;Integrated Security=SSPI;";
16441644

16451645
// <snippet296>
1646-
internal static void SetPartitionInterval(Char interval)
1646+
internal static void SetPartitionInterval(char interval)
16471647
{
16481648
// Valid values are 'd' (daily), 'm' (monthly), and 'y' (yearly). The default is 'm'.
16491649
using (SqlCommand command = new SqlCommand("dbo.SetPartitionInterval"))

samples/snippets/csharp/VS_Snippets_CFX/wfs_invokemethod/cs/program.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//----------------------------------------------------------------
1+
//----------------------------------------------------------------
22
// Copyright (c) Microsoft Corporation. All rights reserved.
33
//----------------------------------------------------------------
44

@@ -215,7 +215,7 @@ static Activity CreateWf()
215215
MethodName = "WriteLine",
216216
Parameters =
217217
{
218-
new InArgument<string>(ctx => String.Format("....the stored value is {0}", resultValue.Get(ctx))),
218+
new InArgument<string>(ctx => string.Format("....the stored value is {0}", resultValue.Get(ctx))),
219219
}
220220
},
221221
//</Snippet4>

samples/snippets/csharp/VS_Snippets_CFX/wfs_sqlstoreextensibility/cs/program.cs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
//----------------------------------------------------------------
1+
//----------------------------------------------------------------
22
// Copyright (c) Microsoft Corporation. All rights reserved.
33
//----------------------------------------------------------------
44

@@ -78,7 +78,7 @@ static Sequence CountingWorkflow()
7878

7979
public class SaveCounter : CodeActivity
8080
{
81-
public InArgument<Int32> Counter { get; set; }
81+
public InArgument<int> Counter { get; set; }
8282

8383
protected override void Execute(CodeActivityContext context )
8484
{
@@ -89,7 +89,7 @@ protected override void Execute(CodeActivityContext context )
8989

9090
class CounterStatus : PersistenceParticipant
9191
{
92-
public Int32 Count { get; set; }
92+
public int Count { get; set; }
9393

9494
protected override void CollectValues(
9595
out IDictionary<XName, object> readWriteValues,

samples/snippets/csharp/VS_Snippets_CLR_Classic/classic AmbiguousMatchException.AmbiguousMatchException2 Example/CS/source.cs

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,15 @@
1-
// <Snippet1>
1+
// <Snippet1>
22
using System;
33
using System.Reflection;
44

55
namespace Ambiguity
66
{
77
class Myambiguous
88
{
9-
//The first overload is typed to an Int32
10-
public static void Mymethod(Int32 number)
9+
//The first overload is typed to an int
10+
public static void Mymethod(int number)
1111
{
12-
Console.WriteLine("I am from 'Int32' method");
12+
Console.WriteLine("I am from 'int' method");
1313
}
1414

1515
//The second overload is typed to a string
@@ -23,15 +23,15 @@ public static void Main()
2323
try
2424
{
2525
//The following does not cause as exception
26-
Mymethod(2); // goes to Mymethod(Int32)
26+
Mymethod(2); // goes to Mymethod(int)
2727
Mymethod("3"); // goes to Mymethod(string)
2828

2929
Type Mytype = Type.GetType("Ambiguity.Myambiguous");
3030

31-
MethodInfo Mymethodinfo32 = Mytype.GetMethod("Mymethod", new Type[]{typeof(Int32)});
31+
MethodInfo Mymethodinfo32 = Mytype.GetMethod("Mymethod", new Type[]{typeof(int)});
3232
MethodInfo Mymethodinfostr = Mytype.GetMethod("Mymethod", new Type[]{typeof(System.String)});
3333

34-
//Invoke a method, utilizing a Int32 integer
34+
//Invoke a method, utilizing a int integer
3535
Mymethodinfo32.Invoke(null, new Object[]{2});
3636

3737
//Invoke the method utilizing a string
@@ -55,9 +55,9 @@ public static void Main()
5555

5656
//This code produces the following output:
5757
//
58-
// I am from 'Int32' method
58+
// I am from 'int' method
5959
// I am from 'string' method.
60-
// I am from 'Int32' method
60+
// I am from 'int' method
6161
// I am from 'string' method.
6262

6363
// System.Reflection.AmbiguousMatchException

0 commit comments

Comments
 (0)