Skip to content

Commit

Permalink
General using cleanup in C# files
Browse files Browse the repository at this point in the history
This removes unnecessary using statements and moves them outside of the namespaces when they were inside them.

I cleaned up the headers a bit for several hundred files, but the cleanup there isn't exhaustive by any means. Changes are only to the tops of files.

To make this work a bit more cleanly I've added GlobalUsings.cs files to some of the assemblies.
  • Loading branch information
JeremyKuhne committed Oct 29, 2024
1 parent 86ef9ee commit 66b7078
Show file tree
Hide file tree
Showing 3,678 changed files with 3,228 additions and 28,317 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace Company.WpfApplication1
namespace Company.WpfApplication1
{
/// <summary>
/// Interaction logic for App.xaml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Windows;

[assembly:ThemeInfo(
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Company.WpfApplication1
namespace Company.WpfApplication1
{
/// <summary>
/// Interaction logic for MainWindow.xaml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,4 @@
#if (!csharpFeature_ImplicitUsings)
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;
#else
using System.Configuration;
using System.Data;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Windows;

[assembly:ThemeInfo(
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
#if (!csharpFeature_ImplicitUsings)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
#else
using System.Text;
using System.Windows;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,4 @@
using System;
using System.Collections.Generic;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Threading.Tasks;
using System.Windows;

namespace Company.WpfApplication1
namespace Company.WpfApplication1
{
/// <summary>
/// Interaction logic for App.xaml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Windows;

[assembly:ThemeInfo(
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Company.WpfApplication1
namespace Company.WpfApplication1
{
/// <summary>
/// Interaction logic for MainWindow.xaml
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;

namespace Company.ClassLibrary1
{
public class Class1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
#if (!csharpFeature_ImplicitUsings)
using System;
#endif

#if (csharpFeature_FileScopedNamespaces)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
using System;

namespace Company.ClassLibrary1
{
public class Class1
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Windows;

[assembly:ThemeInfo(
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Company.WpfCustomControlLibrary
namespace Company.WpfCustomControlLibrary
{
/// <summary>
/// Follow steps 1a or 1b and then 2 to use this custom control in a XAML file.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Windows;

[assembly:ThemeInfo(
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
#if (!csharpFeature_ImplicitUsings)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
#else
using System.Text;
using System.Windows;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Windows;

[assembly:ThemeInfo(
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,19 +1,4 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Company.WpfCustomControlLibrary
namespace Company.WpfCustomControlLibrary
{
/// <summary>
/// Follow steps 1a or 1b and then 2 to use this custom control in a XAML file.
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Windows;

[assembly:ThemeInfo(
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Company.WpfControlLibrary
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Windows;

[assembly:ThemeInfo(
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,4 @@
#if (!csharpFeature_ImplicitUsings)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
#else
using System.Text;
using System.Windows;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
using System.Windows;

[assembly:ThemeInfo(
[assembly: ThemeInfo(
ResourceDictionaryLocation.None, //where theme specific resource dictionaries are located
//(used if a resource is not found in the page,
// or application resource dictionaries)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,18 +1,3 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;

namespace Company.WpfControlLibrary
{
/// <summary>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,8 @@

// This code is generated from mcg\generators\CommandStructure.cs

using System;
using System.Windows.Media.Composition;
using System.Runtime.InteropServices;
using System.Windows.Media.Effects;
using System.Security;

using BOOL = System.UInt32;

Expand Down
23 changes: 3 additions & 20 deletions src/Microsoft.DotNet.Wpf/src/Common/Graphics/exports.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,32 +6,15 @@
// Description:
// Managed exports from MIL core.

using System;
using System.Collections;
using System.ComponentModel;
using System.Threading;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Media.Effects;
using System.Windows.Media.Media3D;
using System.Runtime.InteropServices;
using System.Windows.Media.Animation;
using MS.Internal;
using MS.Internal.PresentationCore;
using MS.Internal.Interop;
using MS.Utility;
using MS.Win32;
using System.Diagnostics;
using System.Collections.Generic;
using System.Security;
using Microsoft.Win32.SafeHandles;

using UnsafeNativeMethods=MS.Win32.PresentationCore.UnsafeNativeMethods;
using SafeNativeMethods=MS.Win32.PresentationCore.SafeNativeMethods;
using HRESULT=MS.Internal.HRESULT;
using SR=MS.Internal.PresentationCore.SR;
using DllImport=MS.Internal.PresentationCore.DllImport;

using UnsafeNativeMethods = MS.Win32.PresentationCore.UnsafeNativeMethods;
using HRESULT = MS.Internal.HRESULT;

/*
*
Expand Down
3 changes: 0 additions & 3 deletions src/Microsoft.DotNet.Wpf/src/Common/Graphics/wgx_av_types.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.

using System;
using System.Runtime.InteropServices;

namespace System.Windows.Media
{
//
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.


using System;
using System.Runtime.InteropServices;

namespace System.Windows.Media.Composition
Expand Down
6 changes: 0 additions & 6 deletions src/Microsoft.DotNet.Wpf/src/Common/Graphics/wgx_exports.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,17 +2,11 @@
// The .NET Foundation licenses this file to you under the MIT license.
// See the LICENSE file in the project root for more information.


using System;
using System.Windows;
using System.Windows.Media;
using System.Windows.Media.Composition;
using System.Windows.Media.Imaging;
using System.Runtime.InteropServices;

using System.Security;
using MS.Internal.PresentationCore;

namespace MS.Internal
{
#region MILRenderTargetBitmap
Expand Down
Loading

0 comments on commit 66b7078

Please sign in to comment.