question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Code Quality: Global usings, single line namespaces

See original GitHub issue

Description

I think we should start the conversation about global usings and single line namespace declarations.

_Originally posted by @lukeblevins in https://github.com/files-community/Files/issues/11832#issuecomment-1484257518_

Concerned code

All cs files

Gains

Better readability

Requirements

  • Agree upon a subset of using statements that are common to most source files
  • Add GlobalUsings.cs
  • Amend code quality guidelines for single line namespace definitions
  • Implement single line namespace defs

Comments

This is under discussion on the discord server

Issue Analytics

  • State:closed
  • Created 6 months ago
  • Comments:5 (5 by maintainers)

github_iconTop GitHub Comments

3reactions
0x5bfacommented, Mar 27, 2023

Here’s my proposal

// System
global using global::System;
global using global::System.Collections.Generic;
global using global::System.Collections.ObjectModel;
global using global::System.Linq;
global using global::System.Text;
global using global::System.Threading;
global using global::System.Threading.Tasks;

// Windows Community Toolkit
global using global::CommunityToolkit.Mvvm.ComponentModel;
global using global::CommunityToolkit.Mvvm.Input;
global using global::CommunityToolkit.Mvvm.Messaging;

// Files Front-end
global using global::Files.App.Helpers;
global using global::Files.App.Extensions;
global using global::Files.App.Filesystem;
// NOTE: We can add more here...

// Files Back-end
global using global::Files.Shared;
global using global::Files.App.Storage;
global using global::Files.Sdk.Storage;
// NOTE: We can add more here...

// Vanara
// NOTE: We can add more here...
1reaction
yaira2commented, Apr 19, 2023

@0x5bfa we can definitely do that but let’s keep it separate from the Global Usings PR.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Global Usings – A Look at New Language Features in C# 10
Welcome to the third part of our series, where we take a closer look at the new C# language features the .NET team...
Read more >
Global Using Directives in C# - Code Maze
We declare global usings by using two ways. In a first way, we define the global using directive in any file within our...
Read more >
CA1050: Declare types in namespaces (code analysis)
Types are declared in namespaces to prevent name collisions, and as a way to organize related types in an object hierarchy.
Read more >
Use C# 10 Global Usings to make namespaces available to ...
Global Usings in C# 10 allow us to declare a namespace as being available to all files in a project so we don't...
Read more >
Global using Directive in C# 10
The purpose of this feature is to keep the code clean and do not have same duplicate lines of using namespace in every...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found