Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
22 commits
Select commit Hold shift + click to select a range
4791fde
chore: upgrade library to net10.0, LangVersion latest, Newtonsoft.Jso…
rbipin May 26, 2026
69f2a2e
chore: align Version and PackageVersion to 2.0.0
rbipin May 26, 2026
3d1ae9b
chore: upgrade test project to net10.0, update all test packages
rbipin May 26, 2026
5cf6a68
chore: migrate solution from .sln to .slnx format
rbipin May 26, 2026
e5296f2
chore: add global.json to pin SDK to 10.0.x
rbipin May 26, 2026
f706240
ci: upgrade GitHub Actions to .NET 10 and bump action versions
rbipin May 26, 2026
f1591e9
docs: update CLAUDE.md for .NET 10 and .slnx solution
rbipin May 26, 2026
82b328f
docs: fix stale framework/version references in Architecture section
rbipin May 26, 2026
2ed1461
reorganize files code to /src
rbipin May 26, 2026
37c91ff
chore: move solution file to repo root, update src/ project paths
rbipin May 26, 2026
093db56
chore: move dotnet-tools.json to .config/ (standard discovery path)
rbipin May 26, 2026
fc97903
chore: add .editorconfig with .NET 10 / C# 13 code style rules
rbipin May 26, 2026
c203a61
chore: fix tuple swap version comment in .editorconfig
rbipin May 26, 2026
98909f7
docs: update CLAUDE.md for src/ layout, editorconfig, and tool restore
rbipin May 26, 2026
19a4576
check in plan for dotnet10 upgrade
rbipin May 26, 2026
aee57d2
docs: improve XML documentation on GenericExtensions public members
rbipin May 27, 2026
ff1ee42
docs: address code quality feedback on GenericExtensions XML docs
rbipin May 27, 2026
950b02f
docs: improve XML documentation on EnumerableExtensions public members
rbipin May 27, 2026
9d0805e
docs: address code quality feedback on EnumerableExtensions XML docs
rbipin May 27, 2026
35ec182
docs: improve XML documentation on StringExtensions.ToNullable
rbipin May 27, 2026
a761479
docs: address code quality feedback on StringExtensions.ToNullable
rbipin May 27, 2026
7ea5d75
add the doc file
rbipin May 27, 2026
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .config/dotnet-tools.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": 1,
"isRoot": true,
"tools": {
"csharpier": {
"version": "1.2.6",
"commands": [
"csharpier"
],
"rollForward": false
}
}
}
241 changes: 241 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,241 @@
root = true

##############################################
# All files
##############################################
[*]
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
charset = utf-8

##############################################
# XML project files
##############################################
[*.{csproj,vbproj,vcxproj,vcxproj.filters,proj,projitems,shproj,slnx}]
indent_size = 2

##############################################
# Config & data files
##############################################
[*.{json,yml,yaml,toml}]
indent_size = 2

[*.xml]
indent_size = 2

##############################################
# Markdown
##############################################
[*.md]
trim_trailing_whitespace = false

##############################################
# C# and VB files
##############################################
[*.{cs,csx,vb,vbx}]
indent_size = 4
tab_width = 4

# ---- .NET code style ----

# Prefer language keywords over BCL type names
dotnet_style_predefined_type_for_locals_parameters_members = true:suggestion
dotnet_style_predefined_type_for_member_access = true:suggestion

# Avoid 'this.' qualification
dotnet_style_qualification_for_field = false:suggestion
dotnet_style_qualification_for_property = false:suggestion
dotnet_style_qualification_for_method = false:suggestion
dotnet_style_qualification_for_event = false:suggestion

# Accessibility modifiers required
dotnet_style_require_accessibility_modifiers = always:suggestion

# Prefer object/collection initializers
dotnet_style_object_initializer = true:suggestion
dotnet_style_collection_initializer = true:suggestion

# Prefer collection expressions (C# 12+)
dotnet_style_prefer_collection_expression = when_types_loosely_match:suggestion

# Null checks
dotnet_style_coalesce_expression = true:suggestion
dotnet_style_null_propagation = true:suggestion
dotnet_style_prefer_is_null_check_over_reference_equality_method = true:suggestion

# Auto-properties
dotnet_style_prefer_auto_properties = true:suggestion

# Compound assignments
dotnet_style_prefer_compound_assignment = true:suggestion

# Simplified boolean expressions
dotnet_style_prefer_simplified_boolean_expressions = true:suggestion

# Explicit tuple names
dotnet_style_explicit_tuple_names = true:suggestion

# Inferred names
dotnet_style_prefer_inferred_tuple_names = true:suggestion
dotnet_style_prefer_inferred_anonymous_type_member_names = true:suggestion

# Parentheses
dotnet_style_parentheses_in_arithmetic_binary_operators = never_if_unnecessary:silent
dotnet_style_parentheses_in_relational_binary_operators = never_if_unnecessary:silent
dotnet_style_parentheses_in_other_binary_operators = never_if_unnecessary:silent
dotnet_style_parentheses_in_other_operators = never_if_unnecessary:silent

# ---- C# code style ----

# var preferences
csharp_style_var_for_built_in_types = true:suggestion
csharp_style_var_when_type_is_apparent = true:suggestion
csharp_style_var_elsewhere = true:suggestion

# Expression-bodied members
csharp_style_expression_bodied_methods = when_on_single_line:suggestion
csharp_style_expression_bodied_constructors = false:suggestion
csharp_style_expression_bodied_operators = when_on_single_line:suggestion
csharp_style_expression_bodied_properties = when_on_single_line:suggestion
csharp_style_expression_bodied_indexers = when_on_single_line:suggestion
csharp_style_expression_bodied_accessors = when_on_single_line:suggestion
csharp_style_expression_bodied_lambdas = when_on_single_line:suggestion
csharp_style_expression_bodied_local_functions = when_on_single_line:suggestion

# Pattern matching
csharp_style_pattern_matching_over_is_with_cast_check = true:suggestion
csharp_style_pattern_matching_over_as_with_null_check = true:suggestion
csharp_style_prefer_switch_expression = true:suggestion
csharp_style_prefer_pattern_matching = true:suggestion
csharp_style_prefer_not_pattern = true:suggestion
csharp_style_prefer_extended_property_pattern = true:suggestion

# Null checks
csharp_style_throw_expression = true:suggestion
csharp_style_conditional_delegate_call = true:suggestion

# Modifier order
csharp_preferred_modifier_order = public,private,protected,internal,file,static,extern,new,virtual,abstract,sealed,override,readonly,unsafe,required,volatile,async:suggestion

# Inlined variable declarations
csharp_style_inlined_variable_declaration = true:suggestion

# Simplify default
csharp_prefer_simple_default_expression = true:suggestion

# Index and range operators (C# 8+)
csharp_style_prefer_index_operator = true:suggestion
csharp_style_prefer_range_operator = true:suggestion

# Deconstructed variable declarations
csharp_style_deconstructed_variable_declaration = true:suggestion

# Using directives placement
csharp_using_directive_placement = outside_namespace:suggestion

# Namespace style (file-scoped, C# 10+)
csharp_style_namespace_declarations = file_scoped:suggestion

# Primary constructors (C# 12+)
csharp_style_prefer_primary_constructors = true:suggestion

# Tuple swap (C# 7.1+)
csharp_style_prefer_tuple_swap = true:suggestion

# Prefer static local functions
csharp_prefer_static_local_function = true:suggestion

# Local functions over anonymous lambdas
csharp_style_prefer_local_over_anonymous_function = true:suggestion

# ---- C# formatting ----

# New lines
csharp_new_line_before_open_brace = all
csharp_new_line_before_else = true
csharp_new_line_before_catch = true
csharp_new_line_before_finally = true
csharp_new_line_before_members_in_object_initializers = true
csharp_new_line_before_members_in_anonymous_types = true
csharp_new_line_between_query_expression_clauses = true

# Indentation
csharp_indent_case_contents = true
csharp_indent_switch_labels = true
csharp_indent_labels = one_less_than_current

# Spacing
csharp_space_after_cast = false
csharp_space_after_keywords_in_control_flow_statements = true
csharp_space_between_method_declaration_parameter_list_parentheses = false
csharp_space_between_method_call_parameter_list_parentheses = false
csharp_space_before_colon_in_inheritance_clause = true
csharp_space_after_colon_in_inheritance_clause = true
csharp_space_around_binary_operators = before_and_after
csharp_space_between_method_declaration_empty_parameter_list_parentheses = false
csharp_space_between_method_call_name_and_opening_parenthesis = false
csharp_space_between_method_call_empty_parameter_list_parentheses = false

# Wrapping
csharp_preserve_single_line_statements = false
csharp_preserve_single_line_blocks = true

# ---- Naming conventions ----

# Interfaces: IPascalCase
dotnet_naming_rule.interface_naming.severity = suggestion
dotnet_naming_rule.interface_naming.symbols = interfaces
dotnet_naming_rule.interface_naming.style = interface_style

dotnet_naming_symbols.interfaces.applicable_kinds = interface
dotnet_naming_symbols.interfaces.applicable_accessibilities = *

dotnet_naming_style.interface_style.required_prefix = I
dotnet_naming_style.interface_style.capitalization = pascal_case

# Private fields: _camelCase
dotnet_naming_rule.private_field_naming.severity = suggestion
dotnet_naming_rule.private_field_naming.symbols = private_fields
dotnet_naming_rule.private_field_naming.style = private_field_style

dotnet_naming_symbols.private_fields.applicable_kinds = field
dotnet_naming_symbols.private_fields.applicable_accessibilities = private, private_protected

dotnet_naming_style.private_field_style.required_prefix = _
dotnet_naming_style.private_field_style.capitalization = camel_case

# Constants: PascalCase
dotnet_naming_rule.constant_naming.severity = suggestion
dotnet_naming_rule.constant_naming.symbols = constants
dotnet_naming_rule.constant_naming.style = pascal_case_style

dotnet_naming_symbols.constants.applicable_kinds = field
dotnet_naming_symbols.constants.required_modifiers = const

dotnet_naming_style.pascal_case_style.capitalization = pascal_case

# Public/internal members: PascalCase
dotnet_naming_rule.public_members_naming.severity = suggestion
dotnet_naming_rule.public_members_naming.symbols = public_members
dotnet_naming_rule.public_members_naming.style = pascal_case_style

dotnet_naming_symbols.public_members.applicable_kinds = class,struct,enum,property,method,event,delegate,namespace
dotnet_naming_symbols.public_members.applicable_accessibilities = public, internal, protected, protected_internal

# Parameters and locals: camelCase
dotnet_naming_rule.parameter_naming.severity = suggestion
dotnet_naming_rule.parameter_naming.symbols = parameters
dotnet_naming_rule.parameter_naming.style = camel_case_style

dotnet_naming_symbols.parameters.applicable_kinds = parameter, local

dotnet_naming_style.camel_case_style.capitalization = camel_case

# ---- Nullable diagnostics ----
dotnet_diagnostic.CS8600.severity = warning
dotnet_diagnostic.CS8602.severity = warning
dotnet_diagnostic.CS8603.severity = warning
dotnet_diagnostic.CS8604.severity = warning
dotnet_diagnostic.CS8618.severity = warning
6 changes: 3 additions & 3 deletions .github/workflows/dotnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,11 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: Setup .NET
uses: actions/setup-dotnet@v2
uses: actions/setup-dotnet@v4
with:
dotnet-version: 6.0.x
dotnet-version: 10.0.x
- name: Restore dependencies
run: dotnet restore
- name: Build
Expand Down
74 changes: 74 additions & 0 deletions CLAUDE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
# CLAUDE.md

This file provides guidance to Claude Code (claude.ai/code) when working with code in this repository.

## Commands

```bash
# Build the entire solution
dotnet build

# Run all tests
dotnet test

# Run tests with verbose output
dotnet test --verbosity normal

# Run a single test by name (partial match works)
dotnet test --filter "FullyQualifiedName~<TestMethodName>"
# Example:
dotnet test --filter "FullyQualifiedName~Verify_In_Exists"

# Run all tests in a specific class
dotnet test --filter "ClassName~EnumerableExtensionTest"

# Build only the library project
dotnet build src/CSharpHelperExtensions/CSharpHelperExtensions.csproj

# Pack as NuGet package
dotnet pack src/CSharpHelperExtensions/CSharpHelperExtensions.csproj

# Restore local .NET tools (CSharpier formatter)
dotnet tool restore

# Build using the solution file explicitly
dotnet build CSharpHelperExtensions.slnx

# Test using the solution file explicitly
dotnet test CSharpHelperExtensions.slnx
```

## Architecture

This is a two-project solution:

- **`src/CSharpHelperExtensions/`** — `net10.0` class library. The publishable NuGet package (`CSharpHelperExtensions` v2.0.0). Depends only on `Newtonsoft.Json`.
- **`src/CSharpHelperExtensions.Test/`** — xUnit test project (`net10.0`) using FluentAssertions.

Root-level config files: `CSharpHelperExtensions.slnx` (solution entry point), `global.json` (pins SDK to 10.0.x), `.editorconfig` (C# code style + formatting rules), `.config/dotnet-tools.json` (CSharpier formatter).

### Extension method namespaces

The library splits extensions across three namespaces — callers must import the right one:

| File | Namespace | Key types |
|------|-----------|-----------|
| `GenericExtensions.cs` | `CSharpHelperExtensions` | `In`, `IsNullOrEmpty` (string), `IsBetween`, `ToJson` |
| `EnumerableExtensions.cs` | `CSharpHelperExtensions.Enumerable` | `IsNullOrEmpty<T>`, `CleanNullOrEmptyItems`, `ContainsOnly`, `AreEqual`, `ForEach`, `Reduce` |
| `StringExtensions.cs` | `CSharpHelperExtensions.Strings` | `ToNullable<T>` |

`IsNullOrEmpty` exists in **both** `GenericExtensions` (for `string`) and `EnumerableExtensions` (for `IEnumerable<T>`). Be careful about which namespace is imported.

### `BetweenComparison` enum

Defined in `GenericExtensions.cs`, controls how `IsBetween` handles bounds:
- `None` (default) — inclusive on both ends
- `ExcludeBoth` — exclusive on both ends
- `ExcludeLower` — excludes lower bound, includes upper
- `ExcludeUpper` — includes lower bound, excludes upper

### `Compare` enum

Defined in `EnumerableExtensions.cs`, used by `AreEqual`:
- `NoOrder` (default) — order-insensitive equality
- `InOrder` — positional equality
22 changes: 0 additions & 22 deletions CSharpHelperExtensions.sln

This file was deleted.

4 changes: 4 additions & 0 deletions CSharpHelperExtensions.slnx
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
<Solution>
<Project Path="src/CSharpHelperExtensions.Test/CSharpHelperExtensions.Test.csproj" />
<Project Path="src/CSharpHelperExtensions/CSharpHelperExtensions.csproj" />
</Solution>
Loading
Loading