About 278,000 results
Open links in new tab
  1. CA1845: Use span-based 'string.Concat' (analysis rule) - .NET

    Nov 12, 2024 · This rule locates string-concatenation expressions that contain Substring calls and suggests replacing Substring with AsSpan and using the span-based overload of String.Concat.

  2. c# - Concatenate ReadOnlySpan<char> - Stack Overflow

    Jun 1, 2018 · Ok, .NET Core 2.1 has landed. With it we've gotten a new way to work with string data being ReadOnlySpan<char>. It's great at splitting string data, but what about combining …

  3. Use span-based 'string.Concat' | OpenRewrite Docs

    It is more efficient to use 'AsSpan' and 'string.Concat', instead of 'Substring' and a concatenation operator. GitHub, Issue Tracker, Maven Central. This recipe is available under the Moderne …

  4. CA1845: Use span-based 'string.Concat' - GitHub

    Calling Substring produces a copy of the extracted substring. By using AsSpan instead of Substring and calling the overload of string.Concat that accepts spans, you can eliminate the …

  5. Efficient String Concatenation in C# Using Span<string>

    Nov 5, 2025 · Using Span<string> for string concatenation is a small but powerful optimization in modern C#. It combines clarity, performance, and memory efficiency, all while leveraging the …

  6. Microsoft .NET Code Analysis: Leveraging Span-Based String ...

    Feb 12, 2025 · Microsoft .NET Code Analysis: Leveraging Span-Based String Concatenation for Improved Performance Posted on February 12, 2025 by dotNetDave

  7. RoslynAnalyzers Use span-based 'string.Concat' | Inspectopedia

    Dec 3, 2025 · It is more efficient to use 'AsSpan' and 'string.Concat', instead of 'Substring' and a concatenation operator. Can be used to locate inspection in e.g. Qodana configuration files, …

  8. Improving C# Performance by Using AsSpan and Avoiding Substring

    Oct 22, 2023 · We'll compare the traditional Substring method with the newer AsSpan method and discuss when to use each for maximum efficiency. The Substring method is a commonly used …

  9. Efficient Memory Management with Span in .NET

    Feb 2, 2024 · One of the powerful features of spans is the ability to create slices without copying data. The AsSpan extension method has overloads supporting range definition, including …

  10. Fastest way to concatenate ReadOnlySpan<char> in C#

    What's the most efficient way to concatenate strings, if I already only have ReadOnlySpan slices? Simplified example: public class Program { public string ConcatSpans (string longstring) { ...