Skip to content

Commit c227d9d

Browse files
committed
Remove file-scoped namespaces to fix CI issues
1 parent 66dbd59 commit c227d9d

File tree

6 files changed

+84
-78
lines changed

6 files changed

+84
-78
lines changed

Microsoft.Toolkit.Uwp.Notifications/Common/EnumFormatter.cs

Lines changed: 36 additions & 35 deletions
Original file line numberDiff line numberDiff line change
@@ -6,51 +6,52 @@
66

77
#nullable enable
88

9-
namespace Microsoft.Toolkit.Uwp.Notifications;
10-
11-
/// <summary>
12-
/// A helper class that can be used to format <see cref="Enum"/> values.
13-
/// </summary>
14-
internal static class EnumFormatter
9+
namespace Microsoft.Toolkit.Uwp.Notifications
1510
{
1611
/// <summary>
17-
/// Returns a <see cref="string"/> representation of an enum value with pascal casing.
12+
/// A helper class that can be used to format <see cref="Enum"/> values.
1813
/// </summary>
19-
/// <typeparam name="T">The <see cref="Enum"/> type to format.</typeparam>
20-
/// <param name="value">The <typeparamref name="T"/> value to format.</param>
21-
/// <returns>The pascal case <see cref="string"/> representation of <paramref name="value"/>.</returns>
22-
public static string? ToPascalCaseString<T>(this T? value)
23-
where T : unmanaged, Enum
14+
internal static class EnumFormatter
2415
{
25-
if (value is null)
16+
/// <summary>
17+
/// Returns a <see cref="string"/> representation of an enum value with pascal casing.
18+
/// </summary>
19+
/// <typeparam name="T">The <see cref="Enum"/> type to format.</typeparam>
20+
/// <param name="value">The <typeparamref name="T"/> value to format.</param>
21+
/// <returns>The pascal case <see cref="string"/> representation of <paramref name="value"/>.</returns>
22+
public static string? ToPascalCaseString<T>(this T? value)
23+
where T : unmanaged, Enum
2624
{
27-
return null;
25+
if (value is null)
26+
{
27+
return null;
28+
}
29+
30+
return ToPascalCaseString(value.Value);
2831
}
2932

30-
return ToPascalCaseString(value.Value);
31-
}
33+
/// <summary>
34+
/// Returns a <see cref="string"/> representation of an enum value with pascal casing.
35+
/// </summary>
36+
/// <typeparam name="T">The <see cref="Enum"/> type to format.</typeparam>
37+
/// <param name="value">The <typeparamref name="T"/> value to format.</param>
38+
/// <returns>The pascal case <see cref="string"/> representation of <paramref name="value"/>.</returns>
39+
public static string? ToPascalCaseString<T>(this T value)
40+
where T : unmanaged, Enum
41+
{
42+
string? text = value.ToString();
3243

33-
/// <summary>
34-
/// Returns a <see cref="string"/> representation of an enum value with pascal casing.
35-
/// </summary>
36-
/// <typeparam name="T">The <see cref="Enum"/> type to format.</typeparam>
37-
/// <param name="value">The <typeparamref name="T"/> value to format.</param>
38-
/// <returns>The pascal case <see cref="string"/> representation of <paramref name="value"/>.</returns>
39-
public static string? ToPascalCaseString<T>(this T value)
40-
where T : unmanaged, Enum
41-
{
42-
string? text = value.ToString();
44+
if (text is null or { Length: 0 })
45+
{
46+
return text;
47+
}
4348

44-
if (text is null or { Length: 0 })
45-
{
46-
return text;
47-
}
49+
if (text is { Length: 1 })
50+
{
51+
return text.ToLowerInvariant();
52+
}
4853

49-
if (text is { Length: 1 })
50-
{
51-
return text.ToLowerInvariant();
54+
return $"{char.ToLowerInvariant(text[0])}{text.Substring(1)}";
5255
}
53-
54-
return $"{char.ToLowerInvariant(text[0])}{text.Substring(1)}";
5556
}
5657
}

Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlAdditionalProperties.cs

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66

77
#nullable enable
88

9-
namespace Microsoft.Toolkit.Uwp.Notifications;
10-
11-
/// <summary>
12-
/// An interface for a notification XML element with additional properties.
13-
/// </summary>
14-
internal interface IHaveXmlAdditionalProperties
9+
namespace Microsoft.Toolkit.Uwp.Notifications
1510
{
1611
/// <summary>
17-
/// Gets the mapping of additional properties.
12+
/// An interface for a notification XML element with additional properties.
1813
/// </summary>
19-
IReadOnlyDictionary<string, string> AdditionalProperties { get; }
20-
}
14+
internal interface IHaveXmlAdditionalProperties
15+
{
16+
/// <summary>
17+
/// Gets the mapping of additional properties.
18+
/// </summary>
19+
IReadOnlyDictionary<string, string> AdditionalProperties { get; }
20+
}
21+
}

Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlChildren.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,15 +6,16 @@
66

77
#nullable enable
88

9-
namespace Microsoft.Toolkit.Uwp.Notifications;
10-
11-
/// <summary>
12-
/// An interface for a notification XML element with additional children.
13-
/// </summary>
14-
internal interface IHaveXmlChildren
9+
namespace Microsoft.Toolkit.Uwp.Notifications
1510
{
1611
/// <summary>
17-
/// Gets the children of the current element.
12+
/// An interface for a notification XML element with additional children.
1813
/// </summary>
19-
IEnumerable<object> Children { get; }
14+
internal interface IHaveXmlChildren
15+
{
16+
/// <summary>
17+
/// Gets the children of the current element.
18+
/// </summary>
19+
IEnumerable<object> Children { get; }
20+
}
2021
}

Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlContent.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
namespace Microsoft.Toolkit.Uwp.Notifications;
6-
7-
/// <summary>
8-
/// An interface for a notification XML element with an explicit XML text content.
9-
/// </summary>
10-
internal interface IHaveXmlText
5+
namespace Microsoft.Toolkit.Uwp.Notifications
116
{
127
/// <summary>
13-
/// Gets the text content of the current element.
8+
/// An interface for a notification XML element with an explicit XML text content.
149
/// </summary>
15-
string Text { get; }
10+
internal interface IHaveXmlText
11+
{
12+
/// <summary>
13+
/// Gets the text content of the current element.
14+
/// </summary>
15+
string Text { get; }
16+
}
1617
}

Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlName.cs

Lines changed: 9 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,16 @@
22
// The .NET Foundation licenses this file to you under the MIT license.
33
// See the LICENSE file in the project root for more information.
44

5-
namespace Microsoft.Toolkit.Uwp.Notifications;
6-
7-
/// <summary>
8-
/// An interface for a notification XML element with a name.
9-
/// </summary>
10-
internal interface IHaveXmlName
5+
namespace Microsoft.Toolkit.Uwp.Notifications
116
{
127
/// <summary>
13-
/// Gets the name of the current element.
8+
/// An interface for a notification XML element with a name.
149
/// </summary>
15-
string Name { get; }
10+
internal interface IHaveXmlName
11+
{
12+
/// <summary>
13+
/// Gets the name of the current element.
14+
/// </summary>
15+
string Name { get; }
16+
}
1617
}

Microsoft.Toolkit.Uwp.Notifications/Common/Serialization/IHaveXmlNamedProperties.cs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,18 @@
66

77
#nullable enable
88

9-
namespace Microsoft.Toolkit.Uwp.Notifications;
10-
11-
/// <summary>
12-
/// An interface for a notification XML element with named properties.
13-
/// </summary>
14-
internal interface IHaveXmlNamedProperties
9+
namespace Microsoft.Toolkit.Uwp.Notifications
1510
{
1611
/// <summary>
17-
/// Enumerates the available named properties for the element.
12+
/// An interface for a notification XML element with named properties.
1813
/// </summary>
19-
/// <returns>A sequence of named properties for the element.</returns>
20-
/// <remarks>The returned values must be valid XML values when <see cref="object.ToString"/> is called on them.</remarks>
21-
IEnumerable<KeyValuePair<string, object?>> EnumerateNamedProperties();
14+
internal interface IHaveXmlNamedProperties
15+
{
16+
/// <summary>
17+
/// Enumerates the available named properties for the element.
18+
/// </summary>
19+
/// <returns>A sequence of named properties for the element.</returns>
20+
/// <remarks>The returned values must be valid XML values when <see cref="object.ToString"/> is called on them.</remarks>
21+
IEnumerable<KeyValuePair<string, object?>> EnumerateNamedProperties();
22+
}
2223
}

0 commit comments

Comments
 (0)