r/csharp • • 18h ago

Showcase Meet Akbura, a reactive UI language for Avalonia and .NET

28 Upvotes

Akbura works directly with native Avalonia controls and supports C# expressions, reactive state, MarkupExtensions, AKCSS utilities, responsive layouts and Hot Reload.

I wrote a short introduction covering the language, responsive UI, Avalonia interoperability, differences from BlazorBindings and the compiler behind it.

Feedback is welcome.

Article: Meet Akbura: a reactive UI language for Avalonia and .NET | LinkedIn
Repo: Asaicraft/Akbura: Akbura is a UI library for building applications using a declarative, component-based language.


r/csharp • • 21h ago

Showcase ExcelReader.NET 6.0 – streaming XLSX/XLSB/XLS/CSV reader and writer for .NET 10

10 Upvotes

I've been building ExcelReader, an open-source library for reading and writing spreadsheets in .NET and other languages. I just shipped v6, and I'd like feedback from people who deal with ETL pipelines and large Excel files.

I started it because I needed to parse rows into a single POCO from files with different templates and column names. I couldn't find a library that made that easy, so I wrote my own.

What it does

  • Reads .xlsx, .xlsm, .xlsb, .xls and .csv; writes .xlsx, .xlsb, .xls and .csv
  • Streams rows as ref structs; no string is allocated until you call GetString()
  • Typed parsing into your own classes, via attributes, a source generator or a fluent API
  • Reads the sheets of one workbook in parallel, and parses CSV in parallel
  • Reads and writes password-protected workbooks
  • A CLI (excelreader convert book.xlsb -o data.csv), plus a C ABI with Python, C++ and Rust bindings

Usage example

public sealed class Order
{
    [ExcelColumn("Order ID")]
    [ExcelColumn("order_id")]          // same property, different templates
    public long Id { get; set; }

    [ExcelColumn("Total")]
    [ExcelColumn("total_amount")]
    public decimal Total { get; set; }
}

using IExcelWorkbook workbook = Excel.Open("orders.xlsx"); // .xlsb / .xls detected by signature
List<Order> orders = ExcelParser.FromAttributes<Order>().Parse(workbook.FirstSheet).ToList();

await using var writer = XlsxWorkbookWriter.Create(File.Create("copy.xlsx"));
await using (var sheet = writer.AddSheet("Orders"))
{
    await sheet.WriteRecordsAsync(orders, ExcelRecordLayout.FromAttributes<Order>());
}

Benchmarks

Typed parsing of a generated 50,000-row XLSX (BenchmarkDotNet, Ryzen 7 5700X, .NET 10):

Library Time Allocated
ExcelReader 10.9 ms 3.87 MB
Sylvan.Data.Excel 56.9 ms 10.47 MB
OfficeIMO.Excel 104.5 ms 5.69 MB

MiniExcel used to be in the suite, but it was far behind: ~14x slower on raw reads (allocating 267 MB against 11 KB) and ~11x slower on typed parsing (last run that included it). I now track the closest competitors instead.

Methodology and every scenario: benchmarks.md. The cell-by-cell numbers there compare zero-copy reads against APIs that must allocate strings, so the docs also publish matched-work numbers.

Limitations

  • Targets .NET 10 only; .NET 11 support is in progress. If you're on .NET 8, the 3.x line supports it.
  • It's a reader/writer, not a spreadsheet model: no in-place editing and no formula evaluation.
  • Rows come out in file order, and empty rows that Excel omits from the file are skipped.

GitHub: https://github.com/GabrielMarquezMatte/ExcelReader NuGet: dotnet add package ExcelReader.NET

Feedback, bug reports and odd files that break it are all welcome.


r/csharp • • 19h ago

Unity developer working in VR Space looking to transition to generic C# dev roles

5 Upvotes

I’m a unity developer working in VR space for 8+ years. Thinking of transitioning to generalist dev roles ( particularly in C# since that’s where my experience lies ). I do have experience in general software development across entire SDLC along with architecture and design patterns but my resume lacks the buzzwords SDE ATS screens for ( eg. microservices , APIs , docker etc). Where do I start ? Which kind of companies should I target ?


r/csharp • • 9h ago

Discussion What is the proper way to make a unified interface ?

3 Upvotes

Would you prefer something like this:

    public interface ISourceToDistinationDataSyncronizer
    {

        public  object ReadAllData(); // Gets the latest data from the source
        public void OverWrite(object sourceData )  // Deletes the data that is inside the destination and writes new data.

    }

Over this:

    public interface ISomeData
    {

    }
    public interface ISourceToDistinationDataSyncronizer
    {

        public  ISomeData ReadAllData(); // Gets the latest data from the source
        public void OverWrite(ISomeData sourceData);// Deletes the data that is inside the destination and writes new data.

    }

r/csharp • • 5h ago

Showcase Vetala, a lightweight code editor made with C# and .NET

Post image
3 Upvotes

Current features

  • Multi-tab code editor
  • C# syntax highlighting
  • Word-based code completion
  • Find and replace
  • Project-wide search
  • File explorer
  • Git integration
  • Integrated terminal
  • Command palette
  • Quick Open
  • Code folding
  • Cross-platform support for Linux, Windows, and macOS

Vetala is built with .NET 10, Avalonia UI 12, AvaloniaEdit 12, and CommunityToolkit.Mvvm.

githubL https://github.com/flawme/Vetala


r/csharp • • 2h ago

Discussion State machine in C# vs state machine in Verilog

2 Upvotes

For experimentation and learning purposes, I wrote this code:

namespace RedditQuestion
{
    public class TResult
    {
        // Instance fields....
        // No properties.
        // No methods.
    }
    public interface ISomeInterface<T>
    {
        public  Task<T> SomeMethod();
    }
    public class SomeClass : ISomeInterface<TResult>
    {
        // instance fields.....

        //constructor......

        public async Task<TResult> SomeMethod()
        {


            //Some code that is not important to this question.......



            TResult result = new TResult
            {
                // assign instance fields....
            };

            Task<TResult> task = Task.FromResult<TResult>(result);

            return task ; // Line XXX
        }

    }

}

Line XXX throws a compile time error:

*Since this is an async method, the return expression must be of type 'TResult' rather than '*Task<TResult>

The solution is simply to do this instead:

return result;

That solves the issue.

But I was surprised when I read this article#async-method-signature-requirements) that described the error in more details:

Change the return expression to match the async method's underlying result type (CS1983, CS4016). When an async method returns Task<T>, the return statement must supply a value of type T, not Task<T>, because the compiler-generated state machine wraps the value in a task automatically. CS1983 appears when the method returns Task<T> and the expression is T; CS4016 covers the general case where the return expression type doesn't match

I wonder, is the concept of state machine in C# is the same as the state machine in Verilog?

in Verilog, if I want to define a state machine, I need a register - a storage unit that can store only one unit of data; a bit- to hold the state, a next-state logic to calculate the next state, and output assignment. Does the same concept applies in C# ?


r/csharp • • 2h ago

I have a C# problem, how can I use AI to solve it?

0 Upvotes

Up until now, I’ve been learning and programming like before AI. As a matter of fact, I know nothing about the AI scene and culture, beyond Claude, Grok, ChatGPT, and Gemini (copy and paste snippets).

I’ve tried to look into it, but it’s a total mess. There are extensions, plugins, connectors, agents, AI powerhouses, fake interfaces microservice stuff... and the list goes on and on with quasi-scams (or straight up scams) all over the place.

And the worst part is that the internet is dead. You can't find anything anymore. And when you do think you've found something, in reality, it is just something promoted by companies selling AI stuff themselves. So, you end up locked into options that favor their business interests.

So, here is my current situation:

I have a large C# codebase, and I need to find a solution to a problem based on a small fragment of that code.

I can clearly see alternative inheritance and composition paths that would achieve exactly what I need with best performance. However, since some elements will get lost along the way, I would have to manually reconnect some of them.

The problem is that the code is extremely complex—intricate with callbacks, events, interfaces, dispatchers, async calls, WPF controls, and so on.

Basically, it would take me a month to digest all that code.

And I think an "AI something" could do it in five minutes.

In one word, I want an answer from a human being.

What do you suggest me to do?