Skip to content

Commit 0693d6c

Browse files
committed
Fix leftover file-scoped namespaces
1 parent e6b4ea3 commit 0693d6c

12 files changed

+6663
-6669
lines changed

CommunityToolkit.Diagnostics/Generated/Guard.Collection.g.cs

Lines changed: 1809 additions & 1810 deletions
Large diffs are not rendered by default.

CommunityToolkit.Diagnostics/Generated/Guard.Collection.tt

Lines changed: 225 additions & 226 deletions
Large diffs are not rendered by default.

CommunityToolkit.Diagnostics/Generated/Guard.Comparable.Numeric.g.cs

Lines changed: 3515 additions & 3516 deletions
Large diffs are not rendered by default.

CommunityToolkit.Diagnostics/Generated/Guard.Comparable.Numeric.tt

Lines changed: 220 additions & 221 deletions
Large diffs are not rendered by default.

CommunityToolkit.Diagnostics/Generated/ThrowHelper.Collection.g.cs

Lines changed: 795 additions & 796 deletions
Large diffs are not rendered by default.

CommunityToolkit.Diagnostics/Generated/ThrowHelper.Collection.tt

Lines changed: 93 additions & 94 deletions
Original file line numberDiff line numberDiff line change
@@ -6,119 +6,118 @@ using System;
66
using System.Collections.Generic;
77
using System.Diagnostics.CodeAnalysis;
88

9-
namespace CommunityToolkit.Diagnostics
9+
namespace CommunityToolkit.Diagnostics;
10+
11+
/// <inheritdoc/>
12+
partial class Guard
1013
{
1114
/// <inheritdoc/>
12-
partial class Guard
15+
partial class ThrowHelper
1316
{
14-
/// <inheritdoc/>
15-
partial class ThrowHelper
16-
{
1717
<#
1818
GenerateTextForItems(EnumerableTypes, item =>
1919
{
2020
#>
21-
/// <summary>
22-
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsEmpty{T}(T[],string)"/> (or an overload) fails.
23-
/// </summary>
24-
[DoesNotReturn]
25-
public static void ThrowArgumentExceptionForIsEmpty<T>(<#=item.Type#> <#=item.Name#>, string name)
26-
{
27-
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must be empty, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}.", name);
28-
}
21+
/// <summary>
22+
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.IsEmpty{T}(T[],string)"/> (or an overload) fails.
23+
/// </summary>
24+
[DoesNotReturn]
25+
public static void ThrowArgumentExceptionForIsEmpty<T>(<#=item.Type#> <#=item.Name#>, string name)
26+
{
27+
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must be empty, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}.", name);
28+
}
2929

30-
/// <summary>
31-
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeEqualTo{T}(T[],int,string)"/> (or an overload) fails.
32-
/// </summary>
33-
[DoesNotReturn]
34-
public static void ThrowArgumentExceptionForHasSizeEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, string name)
35-
{
36-
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size equal to {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}.", name);
37-
}
30+
/// <summary>
31+
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeEqualTo{T}(T[],int,string)"/> (or an overload) fails.
32+
/// </summary>
33+
[DoesNotReturn]
34+
public static void ThrowArgumentExceptionForHasSizeEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, string name)
35+
{
36+
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size equal to {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}.", name);
37+
}
3838

39-
/// <summary>
40-
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeNotEqualTo{T}(T[],int,string)"/> (or an overload) fails.
41-
/// </summary>
42-
[DoesNotReturn]
43-
public static void ThrowArgumentExceptionForHasSizeNotEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, string name)
44-
{
45-
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size not equal to {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}.", name);
46-
}
39+
/// <summary>
40+
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeNotEqualTo{T}(T[],int,string)"/> (or an overload) fails.
41+
/// </summary>
42+
[DoesNotReturn]
43+
public static void ThrowArgumentExceptionForHasSizeNotEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, string name)
44+
{
45+
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size not equal to {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}.", name);
46+
}
4747

48-
/// <summary>
49-
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeGreaterThan{T}(T[],int,string)"/> (or an overload) fails.
50-
/// </summary>
51-
[DoesNotReturn]
52-
public static void ThrowArgumentExceptionForHasSizeGreaterThan<T>(<#=item.Type#> <#=item.Name#>, int size, string name)
53-
{
54-
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size over {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}.", name);
55-
}
48+
/// <summary>
49+
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeGreaterThan{T}(T[],int,string)"/> (or an overload) fails.
50+
/// </summary>
51+
[DoesNotReturn]
52+
public static void ThrowArgumentExceptionForHasSizeGreaterThan<T>(<#=item.Type#> <#=item.Name#>, int size, string name)
53+
{
54+
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size over {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}.", name);
55+
}
5656

57-
/// <summary>
58-
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeGreaterThanOrEqualTo{T}(T[],int,string)"/> (or an overload) fails.
59-
/// </summary>
60-
[DoesNotReturn]
61-
public static void ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, string name)
62-
{
63-
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size of at least {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}.", name);
64-
}
57+
/// <summary>
58+
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeGreaterThanOrEqualTo{T}(T[],int,string)"/> (or an overload) fails.
59+
/// </summary>
60+
[DoesNotReturn]
61+
public static void ThrowArgumentExceptionForHasSizeGreaterThanOrEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, string name)
62+
{
63+
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size of at least {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}.", name);
64+
}
6565

66-
/// <summary>
67-
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeLessThan{T}(T[],int,string)"/> (or an overload) fails.
68-
/// </summary>
69-
[DoesNotReturn]
70-
public static void ThrowArgumentExceptionForHasSizeLessThan<T>(<#=item.Type#> <#=item.Name#>, int size, string name)
71-
{
72-
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size less than {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}.", name);
73-
}
66+
/// <summary>
67+
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeLessThan{T}(T[],int,string)"/> (or an overload) fails.
68+
/// </summary>
69+
[DoesNotReturn]
70+
public static void ThrowArgumentExceptionForHasSizeLessThan<T>(<#=item.Type#> <#=item.Name#>, int size, string name)
71+
{
72+
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size less than {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}.", name);
73+
}
7474

75-
/// <summary>
76-
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeLessThanOrEqualTo{T}(T[],int,string)"/> (or an overload) fails.
77-
/// </summary>
78-
[DoesNotReturn]
79-
public static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, string name)
80-
{
81-
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size less than or equal to {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}.", name);
82-
}
75+
/// <summary>
76+
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeLessThanOrEqualTo{T}(T[],int,string)"/> (or an overload) fails.
77+
/// </summary>
78+
[DoesNotReturn]
79+
public static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo<T>(<#=item.Type#> <#=item.Name#>, int size, string name)
80+
{
81+
throw new ArgumentException($"Parameter {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size less than or equal to {size}, had a size of {AssertString(<#=item.Name#>.<#=item.Size#>)}.", name);
82+
}
8383

84-
/// <summary>
85-
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeEqualTo{T}(T[],T[],string)"/> (or an overload) fails.
86-
/// </summary>
87-
[DoesNotReturn]
88-
public static void ThrowArgumentExceptionForHasSizeEqualTo<T>(<#=item.Type#> source, <#=item.DestinationType#> destination, string name)
89-
{
90-
throw new ArgumentException($"The source {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size equal to {AssertString(destination.<#=item.Size#>)} (the destination), had a size of {AssertString(source.<#=item.Size#>)}.", name);
91-
}
84+
/// <summary>
85+
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeEqualTo{T}(T[],T[],string)"/> (or an overload) fails.
86+
/// </summary>
87+
[DoesNotReturn]
88+
public static void ThrowArgumentExceptionForHasSizeEqualTo<T>(<#=item.Type#> source, <#=item.DestinationType#> destination, string name)
89+
{
90+
throw new ArgumentException($"The source {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size equal to {AssertString(destination.<#=item.Size#>)} (the destination), had a size of {AssertString(source.<#=item.Size#>)}.", name);
91+
}
9292

93-
/// <summary>
94-
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeLessThanOrEqualTo{T}(T[],T[],string)"/> (or an overload) fails.
95-
/// </summary>
96-
[DoesNotReturn]
97-
public static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo<T>(<#=item.Type#> source, <#=item.DestinationType#> destination, string name)
98-
{
99-
throw new ArgumentException($"The source {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size less than or equal to {AssertString(destination.<#=item.Size#>)} (the destination), had a size of {AssertString(source.<#=item.Size#>)}.", name);
100-
}
93+
/// <summary>
94+
/// Throws an <see cref="ArgumentException"/> when <see cref="Guard.HasSizeLessThanOrEqualTo{T}(T[],T[],string)"/> (or an overload) fails.
95+
/// </summary>
96+
[DoesNotReturn]
97+
public static void ThrowArgumentExceptionForHasSizeLessThanOrEqualTo<T>(<#=item.Type#> source, <#=item.DestinationType#> destination, string name)
98+
{
99+
throw new ArgumentException($"The source {AssertString(name)} ({typeof(<#=item.Type#>).ToTypeString()}) must have a size less than or equal to {AssertString(destination.<#=item.Size#>)} (the destination), had a size of {AssertString(source.<#=item.Size#>)}.", name);
100+
}
101101

102-
/// <summary>
103-
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="Guard.IsInRangeFor{T}(int,T[],string)"/> (or an overload) fails.
104-
/// </summary>
105-
[DoesNotReturn]
106-
public static void ThrowArgumentOutOfRangeExceptionForIsInRangeFor<T>(int index, <#=item.Type#> <#=item.Name#>, string name)
107-
{
108-
throw new ArgumentOutOfRangeException(name, index, $"Parameter {AssertString(name)} (int) must be in the range given by <0> and {AssertString(<#=item.Name#>.<#=item.Size#>)} to be a valid index for the target collection ({typeof(<#=item.Type#>).ToTypeString()}), was {AssertString(index)}.");
109-
}
102+
/// <summary>
103+
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="Guard.IsInRangeFor{T}(int,T[],string)"/> (or an overload) fails.
104+
/// </summary>
105+
[DoesNotReturn]
106+
public static void ThrowArgumentOutOfRangeExceptionForIsInRangeFor<T>(int index, <#=item.Type#> <#=item.Name#>, string name)
107+
{
108+
throw new ArgumentOutOfRangeException(name, index, $"Parameter {AssertString(name)} (int) must be in the range given by <0> and {AssertString(<#=item.Name#>.<#=item.Size#>)} to be a valid index for the target collection ({typeof(<#=item.Type#>).ToTypeString()}), was {AssertString(index)}.");
109+
}
110110

111-
/// <summary>
112-
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="Guard.IsNotInRangeFor{T}(int,T[],string)"/> (or an overload) fails.
113-
/// </summary>
114-
[DoesNotReturn]
115-
public static void ThrowArgumentOutOfRangeExceptionForIsNotInRangeFor<T>(int index, <#=item.Type#> <#=item.Name#>, string name)
116-
{
117-
throw new ArgumentOutOfRangeException(name, index, $"Parameter {AssertString(name)} (int) must not be in the range given by <0> and {AssertString(<#=item.Name#>.<#=item.Size#>)} to be an invalid index for the target collection ({typeof(<#=item.Type#>).ToTypeString()}), was {AssertString(index)}.");
118-
}
111+
/// <summary>
112+
/// Throws an <see cref="ArgumentOutOfRangeException"/> when <see cref="Guard.IsNotInRangeFor{T}(int,T[],string)"/> (or an overload) fails.
113+
/// </summary>
114+
[DoesNotReturn]
115+
public static void ThrowArgumentOutOfRangeExceptionForIsNotInRangeFor<T>(int index, <#=item.Type#> <#=item.Name#>, string name)
116+
{
117+
throw new ArgumentOutOfRangeException(name, index, $"Parameter {AssertString(name)} (int) must not be in the range given by <0> and {AssertString(<#=item.Name#>.<#=item.Size#>)} to be an invalid index for the target collection ({typeof(<#=item.Type#>).ToTypeString()}), was {AssertString(index)}.");
118+
}
119119
<#
120120
});
121121
#>
122-
}
123122
}
124123
}

CommunityToolkit.Diagnostics/Internals/Guard.Collection.Generic.ThrowHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace CommunityToolkit.Diagnostics;
1111
partial class Guard
1212
{
1313
/// <inheritdoc/>
14-
private static partial class ThrowHelper
14+
partial class ThrowHelper
1515
{
1616
/// <summary>
1717
/// Throws an <see cref="ArgumentException"/> when <see cref="IsNotEmpty{T}(Span{T},string)"/> fails.

CommunityToolkit.Diagnostics/Internals/Guard.Comparable.Generic.ThrowHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace CommunityToolkit.Diagnostics;
1111
partial class Guard
1212
{
1313
/// <inheritdoc/>
14-
private static partial class ThrowHelper
14+
partial class ThrowHelper
1515
{
1616
/// <summary>
1717
/// Throws an <see cref="ArgumentException"/> when <see cref="IsDefault{T}"/> fails.

CommunityToolkit.Diagnostics/Internals/Guard.Comparable.Numeric.ThrowHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ namespace CommunityToolkit.Diagnostics;
1111
partial class Guard
1212
{
1313
/// <inheritdoc/>
14-
private static partial class ThrowHelper
14+
partial class ThrowHelper
1515
{
1616
/// <summary>
1717
/// Throws an <see cref="ArgumentException"/> when <see cref="IsCloseTo(int,int,uint,string)"/> fails.

CommunityToolkit.Diagnostics/Internals/Guard.IO.ThrowHelper.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ namespace CommunityToolkit.Diagnostics;
1212
partial class Guard
1313
{
1414
/// <inheritdoc/>
15-
private static partial class ThrowHelper
15+
partial class ThrowHelper
1616
{
1717
/// <summary>
1818
/// Throws an <see cref="ArgumentException"/> when <see cref="CanRead"/> fails.

0 commit comments

Comments
 (0)