Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor namespaces for extension types #3743

Merged
31 commits merged into from
Feb 24, 2021
Merged
Show file tree
Hide file tree
Changes from 30 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
194ed82
Restructured the FindParent extensions
Sergio0694 Jan 22, 2021
0d780da
Changed extensions namespaces in .NET packages
Sergio0694 Feb 8, 2021
0cc6cc9
Fixed naming of two XAML markup extensions
Sergio0694 Feb 8, 2021
f2a4d5d
Changed extensions namespaces in UWP packages
Sergio0694 Feb 9, 2021
8422541
Moved some single-file extensions
Sergio0694 Feb 9, 2021
413c940
Refactored the Mouse extensions class
Sergio0694 Feb 9, 2021
aeff664
Refactored the TextBoxRegEx extensions
Sergio0694 Feb 9, 2021
ed27bed
Refactored the Visual/Logical tree extensions
Sergio0694 Feb 9, 2021
fedef9b
Refactored remaining TextBox extensions
Sergio0694 Feb 9, 2021
6ac896b
Refactored Matrix/Rect extensions
Sergio0694 Feb 9, 2021
a31958e
Fixed visibility of some Media internal extensions
Sergio0694 Feb 9, 2021
a91097c
Fixed some build errors in the sample app
Sergio0694 Feb 9, 2021
1f3ff5d
Renamed "uwpui" XML namespace to "ui"
Sergio0694 Feb 9, 2021
8941f6c
Fixed more leftover .Extensions references
Sergio0694 Feb 9, 2021
8299c4e
Fixed some build errors in the HighPerformance tests
Sergio0694 Feb 9, 2021
23a08b9
Fixed .NET Native .rd.xml directives in UWP test project
Sergio0694 Feb 9, 2021
334cad6
Fixed a build error in the UI test app
Sergio0694 Feb 9, 2021
0986b26
Fixed a leftover extension in a unit test
Sergio0694 Feb 9, 2021
ae8148c
Fixed a unit test failure due to incorrect extension matching
Sergio0694 Feb 9, 2021
e7f0986
Fixed some inconsistent internal namespaces
Sergio0694 Feb 20, 2021
fddc70c
Fixed some rebase issues
Sergio0694 Feb 21, 2021
f983ae9
Minor tweaks to some internal namespaaces
Sergio0694 Feb 21, 2021
9c683cc
Fixed some build errors in the smoke tests
Sergio0694 Feb 22, 2021
60008a5
Renamed StretchDirection enum type and property
Sergio0694 Feb 22, 2021
ec188d8
Refactored the Surface Dial extensions for TextBox
Sergio0694 Feb 23, 2021
17f5078
Fix Sample Loading though there's a missing code-path for registratio…
michael-hawker Feb 23, 2021
407d8fd
Added missing property change handler for Surface Dial
Sergio0694 Feb 23, 2021
fc89232
Fix Surface Dial Sample Loading
michael-hawker Feb 23, 2021
a24cfb4
Fix Surface Dial Helpers to function as well as before
michael-hawker Feb 23, 2021
4298a54
Remove unneeded if which I believe was confusing compiler and causing…
michael-hawker Feb 24, 2021
743dc0f
Merge branch 'master' into refactoring/extensions-namespace
michael-hawker Feb 24, 2021
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
2 changes: 1 addition & 1 deletion Microsoft.Toolkit.Diagnostics/Extensions/TypeExtensions.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
#endif
using System.Runtime.CompilerServices;

namespace Microsoft.Toolkit.Extensions
namespace Microsoft.Toolkit.Diagnostics
{
/// <summary>
/// Helpers for working with types.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

namespace Microsoft.Toolkit.Extensions
namespace Microsoft.Toolkit.Diagnostics
{
/// <summary>
/// Helpers for working with value types.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Toolkit.Extensions;

namespace Microsoft.Toolkit.Diagnostics
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System;
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Toolkit.Extensions;

namespace Microsoft.Toolkit.Diagnostics
{
Expand Down
3 changes: 0 additions & 3 deletions Microsoft.Toolkit.Diagnostics/Guard.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,6 @@
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
using System.Runtime.CompilerServices;
#if NETSTANDARD1_4
using Microsoft.Toolkit.Extensions;
#endif

namespace Microsoft.Toolkit.Diagnostics
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Toolkit.Extensions;

namespace Microsoft.Toolkit.Diagnostics
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Toolkit.Extensions;

namespace Microsoft.Toolkit.Diagnostics
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

using System;
using System.Diagnostics.CodeAnalysis;
using Microsoft.Toolkit.Extensions;

namespace Microsoft.Toolkit.Diagnostics
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.IO;
using Microsoft.Toolkit.Extensions;

namespace Microsoft.Toolkit.Diagnostics
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Threading.Tasks;
using Microsoft.Toolkit.Extensions;

namespace Microsoft.Toolkit.Diagnostics
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
using System;
using System.Diagnostics.CodeAnalysis;
using System.Diagnostics.Contracts;
using Microsoft.Toolkit.Extensions;

namespace Microsoft.Toolkit.Diagnostics
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Microsoft.Toolkit.HighPerformance.Buffers.Views;
using Microsoft.Toolkit.HighPerformance.Extensions;
using Microsoft.Toolkit.HighPerformance.Helpers.Internals;

namespace Microsoft.Toolkit.HighPerformance.Buffers
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Microsoft.Toolkit.HighPerformance.Buffers.Internals.Interfaces;
using Microsoft.Toolkit.HighPerformance.Extensions;
using RuntimeHelpers = Microsoft.Toolkit.HighPerformance.Helpers.Internals.RuntimeHelpers;

namespace Microsoft.Toolkit.HighPerformance.Buffers.Internals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System.Buffers;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Microsoft.Toolkit.HighPerformance.Extensions;
using Microsoft.Toolkit.HighPerformance.Helpers;

namespace Microsoft.Toolkit.HighPerformance.Buffers.Internals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Microsoft.Toolkit.HighPerformance.Buffers.Internals.Interfaces;
using Microsoft.Toolkit.HighPerformance.Extensions;
using RuntimeHelpers = Microsoft.Toolkit.HighPerformance.Helpers.Internals.RuntimeHelpers;

namespace Microsoft.Toolkit.HighPerformance.Buffers.Internals
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using System.Runtime.InteropServices;
#endif
using Microsoft.Toolkit.HighPerformance.Buffers.Views;
using Microsoft.Toolkit.HighPerformance.Extensions;

namespace Microsoft.Toolkit.HighPerformance.Buffers
{
Expand Down
1 change: 0 additions & 1 deletion Microsoft.Toolkit.HighPerformance/Buffers/SpanOwner{T}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
using System.Runtime.InteropServices;
#endif
using Microsoft.Toolkit.HighPerformance.Buffers.Views;
using Microsoft.Toolkit.HighPerformance.Extensions;

namespace Microsoft.Toolkit.HighPerformance.Buffers
{
Expand Down
1 change: 0 additions & 1 deletion Microsoft.Toolkit.HighPerformance/Buffers/StringPool.cs
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
using System.Text;
using Microsoft.Toolkit.HighPerformance.Extensions;
#if !NETSTANDARD1_4
using Microsoft.Toolkit.HighPerformance.Helpers;
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#if SPAN_RUNTIME_SUPPORT
using System.Runtime.InteropServices;
#endif
using Microsoft.Toolkit.HighPerformance.Extensions;
using Microsoft.Toolkit.HighPerformance.Helpers.Internals;
using Microsoft.Toolkit.HighPerformance.Memory.Internals;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,16 @@ public bool MoveNext()
{
this.start = newEnd;

int index = this.span.Slice(newEnd).IndexOf(this.separator);
// We need to call this extension explicitly or the extension method resolution rules for the C# compiler
// will end up picking Microsoft.Toolkit.HighPerformance.ReadOnlySpanExtensions.IndexOf instead, even
// though the latter takes the parameter via a readonly reference. This is because the "in" modifier is
// implicit, which makes the signature compatible, and because extension methods are matched in such a
// way that methods "closest" to where they're used are preferred. Since this type shares the same root
// namespace, this makes that extension a better match, so that it overrides the MemoryExtensions one.
// This is not a problem for consumers of this package, as their code would be outside of the
// Microsoft.Toolkit.HighPerformance namespace, so both extensions would be "equally distant", so that
// when they're both in scope it will be possible to choose which one to use by adding an explicit "in".
int index = System.MemoryExtensions.IndexOf(this.span.Slice(newEnd), this.separator);

// Extract the current subsequence
if (index >= 0)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
#if SPAN_RUNTIME_SUPPORT
using System.Runtime.InteropServices;
#endif
using Microsoft.Toolkit.HighPerformance.Extensions;
using Microsoft.Toolkit.HighPerformance.Helpers.Internals;
#if SPAN_RUNTIME_SUPPORT
using Microsoft.Toolkit.HighPerformance.Memory.Internals;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
using Microsoft.Toolkit.HighPerformance.Helpers.Internals;
using RuntimeHelpers = Microsoft.Toolkit.HighPerformance.Helpers.Internals.RuntimeHelpers;

namespace Microsoft.Toolkit.HighPerformance.Extensions
namespace Microsoft.Toolkit.HighPerformance
{
/// <summary>
/// Helpers for working with the <see cref="Array"/> type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
using Microsoft.Toolkit.HighPerformance.Helpers.Internals;
using RuntimeHelpers = Microsoft.Toolkit.HighPerformance.Helpers.Internals.RuntimeHelpers;

namespace Microsoft.Toolkit.HighPerformance.Extensions
namespace Microsoft.Toolkit.HighPerformance
{
/// <summary>
/// Helpers for working with the <see cref="Array"/> type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
using Microsoft.Toolkit.HighPerformance.Helpers.Internals;
using RuntimeHelpers = Microsoft.Toolkit.HighPerformance.Helpers.Internals.RuntimeHelpers;

namespace Microsoft.Toolkit.HighPerformance.Extensions
namespace Microsoft.Toolkit.HighPerformance
{
/// <summary>
/// Helpers for working with the <see cref="Array"/> type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,8 @@
using System.Runtime.CompilerServices;
using Microsoft.Toolkit.HighPerformance.Buffers;
using Microsoft.Toolkit.HighPerformance.Streams;
using Microsoft.Toolkit.HighPerformance.Streams.Sources;

namespace Microsoft.Toolkit.HighPerformance.Extensions
namespace Microsoft.Toolkit.HighPerformance
{
/// <summary>
/// Helpers for working with the <see cref="ArrayPoolBufferWriter{T}"/> type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
using System;
using System.Buffers;

namespace Microsoft.Toolkit.HighPerformance.Extensions
namespace Microsoft.Toolkit.HighPerformance
{
/// <summary>
/// Helpers for working with the <see cref="ArrayPool{T}"/> type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;

namespace Microsoft.Toolkit.HighPerformance.Extensions
namespace Microsoft.Toolkit.HighPerformance
{
/// <summary>
/// Helpers for working with the <see cref="bool"/> type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
using System.Runtime.CompilerServices;
using Microsoft.Toolkit.HighPerformance.Helpers;

namespace Microsoft.Toolkit.HighPerformance.Extensions
namespace Microsoft.Toolkit.HighPerformance
{
/// <summary>
/// Helpers for working with the <see cref="HashCode"/> type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,8 @@
using System.Runtime.InteropServices;
using Microsoft.Toolkit.HighPerformance.Buffers;
using Microsoft.Toolkit.HighPerformance.Streams;
using Microsoft.Toolkit.HighPerformance.Streams.Sources;

namespace Microsoft.Toolkit.HighPerformance.Extensions
namespace Microsoft.Toolkit.HighPerformance
{
/// <summary>
/// Helpers for working with the <see cref="IBufferWriter{T}"/> type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using System.Runtime.CompilerServices;
using MemoryStream = Microsoft.Toolkit.HighPerformance.Streams.MemoryStream;

namespace Microsoft.Toolkit.HighPerformance.Extensions
namespace Microsoft.Toolkit.HighPerformance
{
/// <summary>
/// Helpers for working with the <see cref="IMemoryOwner{T}"/> type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;

namespace Microsoft.Toolkit.HighPerformance.Extensions
namespace Microsoft.Toolkit.HighPerformance
{
/// <summary>
/// Helpers for working with the <see cref="List{T}"/> type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using System.Runtime.InteropServices;
using MemoryStream = Microsoft.Toolkit.HighPerformance.Streams.MemoryStream;

namespace Microsoft.Toolkit.HighPerformance.Extensions
namespace Microsoft.Toolkit.HighPerformance
{
/// <summary>
/// Helpers for working with the <see cref="Memory{T}"/> type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
using Microsoft.Toolkit.HighPerformance.Buffers.Internals.Interfaces;
using MemoryStream = Microsoft.Toolkit.HighPerformance.Streams.MemoryStream;

namespace Microsoft.Toolkit.HighPerformance.Extensions
namespace Microsoft.Toolkit.HighPerformance
{
/// <summary>
/// Helpers for working with the <see cref="ReadOnlyMemory{T}"/> type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using Microsoft.Toolkit.HighPerformance.Enumerables;
using Microsoft.Toolkit.HighPerformance.Helpers.Internals;

namespace Microsoft.Toolkit.HighPerformance.Extensions
namespace Microsoft.Toolkit.HighPerformance
{
/// <summary>
/// Helpers for working with the <see cref="ReadOnlySpan{T}"/> type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
using Microsoft.Toolkit.HighPerformance.Enumerables;
using Microsoft.Toolkit.HighPerformance.Helpers.Internals;

namespace Microsoft.Toolkit.HighPerformance.Extensions
namespace Microsoft.Toolkit.HighPerformance
{
/// <summary>
/// Helpers for working with the <see cref="Span{T}"/> type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
using System.Runtime.CompilerServices;
using System.Threading;

namespace Microsoft.Toolkit.HighPerformance.Extensions
namespace Microsoft.Toolkit.HighPerformance
{
/// <summary>
/// Helpers for working with the <see cref="SpinLock"/> type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
using System.Threading.Tasks;
#endif

namespace Microsoft.Toolkit.HighPerformance.Extensions
namespace Microsoft.Toolkit.HighPerformance
{
/// <summary>
/// Helpers for working with the <see cref="Stream"/> type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
using Microsoft.Toolkit.HighPerformance.Enumerables;
using Microsoft.Toolkit.HighPerformance.Helpers.Internals;

namespace Microsoft.Toolkit.HighPerformance.Extensions
namespace Microsoft.Toolkit.HighPerformance
{
/// <summary>
/// Helpers for working with the <see cref="string"/> type.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Diagnostics.Contracts;
using System.Numerics;
using System.Runtime.CompilerServices;
using Microsoft.Toolkit.HighPerformance.Extensions;

namespace Microsoft.Toolkit.HighPerformance.Helpers.Internals
{
Expand Down
1 change: 0 additions & 1 deletion Microsoft.Toolkit.HighPerformance/Memory/Memory2D{T}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#if SPAN_RUNTIME_SUPPORT
using Microsoft.Toolkit.HighPerformance.Buffers.Internals;
#endif
using Microsoft.Toolkit.HighPerformance.Extensions;
using Microsoft.Toolkit.HighPerformance.Helpers;
using Microsoft.Toolkit.HighPerformance.Memory.Internals;
using Microsoft.Toolkit.HighPerformance.Memory.Views;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
#if SPAN_RUNTIME_SUPPORT
using Microsoft.Toolkit.HighPerformance.Buffers.Internals;
#endif
using Microsoft.Toolkit.HighPerformance.Extensions;
using Microsoft.Toolkit.HighPerformance.Helpers;
using Microsoft.Toolkit.HighPerformance.Memory.Internals;
using Microsoft.Toolkit.HighPerformance.Memory.Views;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Microsoft.Toolkit.HighPerformance.Extensions;
#if !SPAN_RUNTIME_SUPPORT
using Microsoft.Toolkit.HighPerformance.Helpers;
#endif
Expand Down
1 change: 0 additions & 1 deletion Microsoft.Toolkit.HighPerformance/Memory/Span2D{T}.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@
using System.Diagnostics.Contracts;
using System.Runtime.CompilerServices;
using System.Runtime.InteropServices;
using Microsoft.Toolkit.HighPerformance.Extensions;
#if !SPAN_RUNTIME_SUPPORT
using Microsoft.Toolkit.HighPerformance.Helpers;
#endif
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
using System.Runtime.CompilerServices;
using Microsoft.Toolkit.HighPerformance.Buffers;

namespace Microsoft.Toolkit.HighPerformance.Streams.Sources
namespace Microsoft.Toolkit.HighPerformance.Streams
{
/// <summary>
/// An <see cref="IBufferWriter{T}"/> implementation wrapping an <see cref="ArrayPoolBufferWriter{T}"/> instance.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
using System.Runtime.CompilerServices;
#if SPAN_RUNTIME_SUPPORT
using System.Runtime.InteropServices;
using Microsoft.Toolkit.HighPerformance.Extensions;
#endif

namespace Microsoft.Toolkit.HighPerformance.Streams
Expand Down
Loading