Skip to content

Commit 161a251

Browse files
authored
Normalizes trailing spaces in samples, Part 2 (#4126)
1 parent a71c203 commit 161a251

File tree

1,259 files changed

+10000
-10000
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

1,259 files changed

+10000
-10000
lines changed

samples/snippets/csharp/VS_Snippets_CLR/IsDefaultAttribute/CS/defattr.cs

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,10 @@
22
using System;
33
using System.Reflection;
44

5-
namespace DefAttrCS
5+
namespace DefAttrCS
66
{
77
// An enumeration of animals. Start at 1 (0 = uninitialized).
8-
public enum Animal
8+
public enum Animal
99
{
1010
// Pets.
1111
Dog = 1,
@@ -14,16 +14,16 @@ public enum Animal
1414
}
1515

1616
// A custom attribute to allow a target to have a pet.
17-
public class AnimalTypeAttribute : Attribute
17+
public class AnimalTypeAttribute : Attribute
1818
{
1919
// The constructor is called when the attribute is set.
20-
public AnimalTypeAttribute(Animal pet)
20+
public AnimalTypeAttribute(Animal pet)
2121
{
2222
thePet = pet;
2323
}
2424

2525
// Provide a default constructor and make Dog the default.
26-
public AnimalTypeAttribute()
26+
public AnimalTypeAttribute()
2727
{
2828
thePet = Animal.Dog;
2929
}
@@ -32,14 +32,14 @@ public AnimalTypeAttribute()
3232
protected Animal thePet;
3333

3434
// .. and show a copy to the outside world.
35-
public Animal Pet
35+
public Animal Pet
3636
{
3737
get { return thePet; }
3838
set { thePet = Pet; }
3939
}
4040

4141
// Override IsDefaultAttribute to return the correct response.
42-
public override bool IsDefaultAttribute()
42+
public override bool IsDefaultAttribute()
4343
{
4444
if (thePet == Animal.Dog)
4545
return true;
@@ -48,30 +48,30 @@ public override bool IsDefaultAttribute()
4848
}
4949
}
5050

51-
public class TestClass
51+
public class TestClass
5252
{
5353
// Use the default constructor.
5454
[AnimalType]
5555
public void Method1()
5656
{}
5757
}
5858

59-
class DemoClass
59+
class DemoClass
6060
{
61-
static void Main(string[] args)
61+
static void Main(string[] args)
6262
{
6363
// Get the class type to access its metadata.
6464
Type clsType = typeof(TestClass);
6565
// Get type information for the method.
6666
MethodInfo mInfo = clsType.GetMethod("Method1");
6767
// Get the AnimalType attribute for the method.
68-
AnimalTypeAttribute atAttr =
68+
AnimalTypeAttribute atAttr =
6969
(AnimalTypeAttribute)Attribute.GetCustomAttribute(mInfo,
7070
typeof(AnimalTypeAttribute));
7171
// Check to see if the default attribute is applied.
7272
Console.WriteLine("The attribute {0} for method {1} in class {2}",
73-
atAttr.Pet, mInfo.Name, clsType.Name);
74-
Console.WriteLine("{0} the default for the AnimalType attribute.",
73+
atAttr.Pet, mInfo.Name, clsType.Name);
74+
Console.WriteLine("{0} the default for the AnimalType attribute.",
7575
atAttr.IsDefaultAttribute() ? "is" : "is not");
7676
}
7777
}

samples/snippets/csharp/VS_Snippets_CLR/IsDefined/CS/id1.cs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,24 +17,24 @@ static void Main(string[] args)
1717
// Store the assembly's name.
1818
String assyName = assy.GetName().Name;
1919
// See if the Assembly Description is defined.
20-
bool isdef = Attribute.IsDefined(assy,
20+
bool isdef = Attribute.IsDefined(assy,
2121
typeof(AssemblyDescriptionAttribute));
2222
if (isdef)
2323
{
2424
// Affirm that the attribute is defined.
2525
Console.WriteLine("The AssemblyDescription attribute " +
2626
"is defined for assembly {0}.", assyName);
2727
// Get the description attribute itself.
28-
AssemblyDescriptionAttribute adAttr =
28+
AssemblyDescriptionAttribute adAttr =
2929
(AssemblyDescriptionAttribute)Attribute.GetCustomAttribute(
3030
assy, typeof(AssemblyDescriptionAttribute));
3131
// Display the description.
3232
if (adAttr != null)
33-
Console.WriteLine("The description is \"{0}\".",
33+
Console.WriteLine("The description is \"{0}\".",
3434
adAttr.Description);
3535
else
3636
Console.WriteLine("The description could not " +
37-
"be retrieved.");
37+
"be retrieved.");
3838
}
3939
else
4040
Console.WriteLine("The AssemblyDescription attribute is not " +

samples/snippets/csharp/VS_Snippets_CLR/IsDefined/CS/id2.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ static void Main(string[] args)
1313
// Get the class type to access its metadata.
1414
Type clsType = typeof(DemoClass);
1515
// See if the Debuggable attribute is defined for this module.
16-
bool isDef = Attribute.IsDefined(clsType.Module,
16+
bool isDef = Attribute.IsDefined(clsType.Module,
1717
typeof(DebuggableAttribute));
1818
// Display the result.
1919
Console.WriteLine("The Debuggable attribute {0} " +
@@ -25,7 +25,7 @@ static void Main(string[] args)
2525
{
2626
// Retrieve the attribute itself.
2727
DebuggableAttribute dbgAttr = (DebuggableAttribute)
28-
Attribute.GetCustomAttribute(clsType.Module,
28+
Attribute.GetCustomAttribute(clsType.Module,
2929
typeof(DebuggableAttribute));
3030
if (dbgAttr != null)
3131
{

samples/snippets/csharp/VS_Snippets_CLR/IsDefined/CS/id3.cs

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,17 @@
33
using System.Reflection;
44
using System.Runtime.InteropServices;
55

6-
namespace IsDef3CS
6+
namespace IsDef3CS
77
{
88
// Assign a Guid attribute to a class.
99
[Guid("BF235B41-52D1-46cc-9C55-046793DB363F")]
10-
public class TestClass
10+
public class TestClass
1111
{
1212
}
1313

14-
public class DemoClass
14+
public class DemoClass
1515
{
16-
static void Main(string[] args)
16+
static void Main(string[] args)
1717
{
1818
// Get the class type to access its metadata.
1919
Type clsType = typeof(TestClass);
@@ -23,15 +23,15 @@ static void Main(string[] args)
2323
Console.WriteLine("The Guid attribute {0} defined for class {1}.",
2424
isDef ? "is" : "is not", clsType.Name);
2525
// If it's defined, display the GUID.
26-
if (isDef)
26+
if (isDef)
2727
{
28-
GuidAttribute guidAttr =
29-
(GuidAttribute)Attribute.GetCustomAttribute(clsType,
28+
GuidAttribute guidAttr =
29+
(GuidAttribute)Attribute.GetCustomAttribute(clsType,
3030
typeof(GuidAttribute));
3131
if (guidAttr != null)
3232
Console.WriteLine("GUID: {" + guidAttr.Value + "}.");
3333
else
34-
Console.WriteLine("The Guid attribute could " +
34+
Console.WriteLine("The Guid attribute could " +
3535
"not be retrieved.");
3636
}
3737
}

samples/snippets/csharp/VS_Snippets_CLR/IsDefined/CS/id4.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@
22
using System;
33
using System.Reflection;
44

5-
namespace IsDef4CS
5+
namespace IsDef4CS
66
{
7-
public class TestClass
7+
public class TestClass
88
{
99
// Assign the Obsolete attribute to a method.
1010
[Obsolete("This method is obsolete. Use Method2 instead.")]
@@ -14,9 +14,9 @@ public void Method2()
1414
{}
1515
}
1616

17-
public class DemoClass
17+
public class DemoClass
1818
{
19-
static void Main(string[] args)
19+
static void Main(string[] args)
2020
{
2121
// Get the class type to access its metadata.
2222
Type clsType = typeof(TestClass);
@@ -28,10 +28,10 @@ static void Main(string[] args)
2828
Console.WriteLine("The Obsolete Attribute {0} defined for {1} of class {2}.",
2929
isDef ? "is" : "is not", mInfo.Name, clsType.Name);
3030
// If it's defined, display the attribute's message.
31-
if (isDef)
31+
if (isDef)
3232
{
33-
ObsoleteAttribute obsAttr =
34-
(ObsoleteAttribute)Attribute.GetCustomAttribute(
33+
ObsoleteAttribute obsAttr =
34+
(ObsoleteAttribute)Attribute.GetCustomAttribute(
3535
mInfo, typeof(ObsoleteAttribute));
3636
if (obsAttr != null)
3737
Console.WriteLine("The message is: \"{0}\".",

samples/snippets/csharp/VS_Snippets_CLR/IsDefined/CS/id5.cs

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,35 +2,35 @@
22
using System;
33
using System.Reflection;
44

5-
namespace IsDef5CS
5+
namespace IsDef5CS
66
{
7-
public class TestClass
7+
public class TestClass
88
{
99
// Assign a ParamArray attribute to the parameter using the keyword.
1010
public void Method1(params String[] args)
1111
{}
1212
}
1313

14-
public class DemoClass
14+
public class DemoClass
1515
{
16-
static void Main(string[] args)
16+
static void Main(string[] args)
1717
{
1818
// Get the class type to access its metadata.
1919
Type clsType = typeof(TestClass);
2020
// Get the MethodInfo object for Method1.
2121
MethodInfo mInfo = clsType.GetMethod("Method1");
2222
// Get the ParameterInfo array for the method parameters.
2323
ParameterInfo[] pInfo = mInfo.GetParameters();
24-
if (pInfo != null)
24+
if (pInfo != null)
2525
{
2626
// See if the ParamArray attribute is defined.
27-
bool isDef = Attribute.IsDefined(pInfo[0],
27+
bool isDef = Attribute.IsDefined(pInfo[0],
2828
typeof(ParamArrayAttribute));
2929
// Display the result.
3030
Console.WriteLine("The ParamArray attribute {0} defined for " +
3131
"parameter {1} of method {2}.",
3232
isDef ? "is" : "is not",
33-
pInfo[0].Name,
33+
pInfo[0].Name,
3434
mInfo.Name);
3535
}
3636
else

samples/snippets/csharp/VS_Snippets_CLR/IsolatedStoragePermissionAttribute/CS/IsolatedStoragePermissionAttribute.cs

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
1-
//Types:System.Security.Permissions.IsolatedStorageContainment (enum)
2-
//Types:System.Security.Permissions.IsolatedStoragePermissionAttribute
3-
//Types:System.Security.Permissions.SecurityAction
1+
//Types:System.Security.Permissions.IsolatedStorageContainment (enum)
2+
//Types:System.Security.Permissions.IsolatedStoragePermissionAttribute
3+
//Types:System.Security.Permissions.SecurityAction
44
//<snippet1>
55
using System;
66
using System.Security.Permissions;
77
using System.IO.IsolatedStorage;
88
using System.IO;
99

10-
// Notify the CLR to only grant IsolatedStorageFilePermission to called methods.
11-
// This restricts the called methods to working only with storage files that are isolated
10+
// Notify the CLR to only grant IsolatedStorageFilePermission to called methods.
11+
// This restricts the called methods to working only with storage files that are isolated
1212
// by user and assembly.
1313
[IsolatedStorageFilePermission(SecurityAction.PermitOnly, UsageAllowed = IsolatedStorageContainment.AssemblyIsolationByUser)]
1414
public sealed class App
@@ -20,7 +20,7 @@ static void Main()
2020
private static void WriteIsolatedStorage()
2121
{
2222
// Attempt to create a storage file that is isolated by user and assembly.
23-
// IsolatedStorageFilePermission granted to the attribute at the top of this file
23+
// IsolatedStorageFilePermission granted to the attribute at the top of this file
2424
// allows CLR to load this assembly and execution of this statement.
2525
using (Stream s = new IsolatedStorageFileStream("AssemblyData", FileMode.Create, IsolatedStorageFile.GetUserStoreForAssembly()))
2626
{

0 commit comments

Comments
 (0)