Skip to content

Commit

Permalink
File scoped namespaces
Browse files Browse the repository at this point in the history
  • Loading branch information
cb-martinsmith committed Aug 20, 2024
1 parent b8c4fcc commit 163a246
Show file tree
Hide file tree
Showing 7 changed files with 1,091 additions and 1,082 deletions.
18 changes: 15 additions & 3 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ csharp_style_expression_bodied_accessors = true:none
csharp_style_pattern_matching_over_is_with_cast_check = true : suggestion
csharp_style_pattern_matching_over_as_with_null_check = true : suggestion
csharp_style_inlined_variable_declaration = true : suggestion
csharp_style_throw_expression = true : suggestion
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true : suggestion

# Newline settings
Expand All @@ -97,7 +97,7 @@ csharp_indent_labels = flush
csharp_indent_switch_labels = true
csharp_new_line_between_query_expression_clauses = true
csharp_prefer_braces = true:silent
csharp_prefer_simple_default_expression = true : suggestion
csharp_prefer_simple_default_expression = true:suggestion
csharp_style_deconstructed_variable_declaration = true : suggestion
csharp_preserve_single_line_blocks = true
csharp_preserve_single_line_statements = true
Expand All @@ -114,11 +114,13 @@ csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_parentheses = false
csharp_style_pattern_local_over_anonymous_function = true : suggestion
csharp_prefer_simple_using_statement = true:suggestion
csharp_style_namespace_declarations = block_scoped:silent
csharp_style_namespace_declarations = file_scoped:silent
csharp_style_prefer_method_group_conversion = true:silent
csharp_style_prefer_top_level_statements = true:silent
csharp_style_expression_bodied_lambdas = true:silent
csharp_style_expression_bodied_local_functions = false:silent
csharp_style_prefer_primary_constructors = true:suggestion
csharp_style_prefer_null_check_over_type_check = true:suggestion


# XML and Config style settings:
Expand Down Expand Up @@ -196,3 +198,13 @@ dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion
dotnet_style_operator_placement_when_wrapping = beginning_of_line
tab_width = 4
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion
dotnet_style_prefer_conditional_expression_over_assignment = true:silent
dotnet_style_prefer_conditional_expression_over_return = true:silent
dotnet_style_explicit_tuple_names = true:suggestion
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion
dotnet_style_prefer_compound_assignment = true:suggestion
dotnet_style_prefer_simplified_interpolation = true:suggestion
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion
dotnet_style_namespace_match_folder = true:suggestion
2 changes: 2 additions & 0 deletions src/DNX.Extensions/DNX.Extensions.csproj.DotSettings
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
<s:String x:Key="/Default/CodeInspection/CSharpLanguageProject/LanguageLevel/@EntryValue">CSharp100</s:String></wpf:ResourceDictionary>
51 changes: 25 additions & 26 deletions src/DNX.Extensions/Enumerations/EnumerableExtensions.cs
Original file line number Diff line number Diff line change
@@ -1,34 +1,33 @@
using System;
using System;
using System.Collections.Generic;
using System.Linq;

namespace DNX.Extensions.Enumerations
namespace DNX.Extensions.Enumerations;

Check failure on line 5 in src/DNX.Extensions/Enumerations/EnumerableExtensions.cs

View workflow job for this annotation

GitHub Actions / Build .NET

Feature 'file-scoped namespace' is not available in C# 7.3. Please use language version 10.0 or greater.

Check failure on line 5 in src/DNX.Extensions/Enumerations/EnumerableExtensions.cs

View workflow job for this annotation

GitHub Actions / Build .NET

Feature 'file-scoped namespace' is not available in C# 7.3. Please use language version 10.0 or greater.

public static class EnumerableExtensions
{
public static class EnumerableExtensions
/// <summary>
/// Determines whether the specified enumerable has any elements and is not null
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="enumerable">The enumerable.</param>
/// <returns><c>true</c> if the specified enumerable has any elements; otherwise, <c>false</c>.</returns>
/// <remarks>Also available as an extension method</remarks>
public static bool HasAny<T>(this IEnumerable<T> enumerable)
{
/// <summary>
/// Determines whether the specified enumerable has any elements and is not null
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="enumerable">The enumerable.</param>
/// <returns><c>true</c> if the specified enumerable has any elements; otherwise, <c>false</c>.</returns>
/// <remarks>Also available as an extension method</remarks>
public static bool HasAny<T>(this IEnumerable<T> enumerable)
{
return enumerable != null && enumerable.Any();
}
return enumerable != null && enumerable.Any();
}

/// <summary>
/// Determines whether the specified enumerable has any elements that match the predicate and is not null
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="enumerable">The enumerable.</param>
/// <param name="predicate">The predicate.</param>
/// <returns><c>true</c> if the specified predicate has any elements that match the predicate; otherwise, <c>false</c>.</returns>
/// <remarks>Also available as an extension method</remarks>
public static bool HasAny<T>(this IEnumerable<T> enumerable, Func<T, bool> predicate)
{
return enumerable != null && enumerable.Any(predicate);
}
/// <summary>
/// Determines whether the specified enumerable has any elements that match the predicate and is not null
/// </summary>
/// <typeparam name="T"></typeparam>
/// <param name="enumerable">The enumerable.</param>
/// <param name="predicate">The predicate.</param>
/// <returns><c>true</c> if the specified predicate has any elements that match the predicate; otherwise, <c>false</c>.</returns>
/// <remarks>Also available as an extension method</remarks>
public static bool HasAny<T>(this IEnumerable<T> enumerable, Func<T, bool> predicate)
{
return enumerable != null && enumerable.Any(predicate);
}
}
27 changes: 13 additions & 14 deletions src/DNX.Extensions/Strings/SplitDelimiterType.cs
Original file line number Diff line number Diff line change
@@ -1,18 +1,17 @@
namespace DNX.Extensions.Strings
namespace DNX.Extensions.Strings;

Check failure on line 1 in src/DNX.Extensions/Strings/SplitDelimiterType.cs

View workflow job for this annotation

GitHub Actions / Build .NET

Feature 'file-scoped namespace' is not available in C# 7.3. Please use language version 10.0 or greater.

Check failure on line 1 in src/DNX.Extensions/Strings/SplitDelimiterType.cs

View workflow job for this annotation

GitHub Actions / Build .NET

Feature 'file-scoped namespace' is not available in C# 7.3. Please use language version 10.0 or greater.

/// <summary>
/// How the delimiter is to be treated when splitting text
/// </summary>
public enum SplitDelimiterType
{
/// <summary>
/// How the delimiter is to be treated when splitting text
/// Any specified value can be a delimiter
/// </summary>
public enum SplitDelimiterType
{
/// <summary>
/// Any specified value can be a delimiter
/// </summary>
Any = 0,
Any = 0,

/// <summary>
/// All specified values are the delimiter
/// </summary>
All
}
}
/// <summary>
/// All specified values are the delimiter
/// </summary>
All
}
Loading

0 comments on commit 163a246

Please sign in to comment.