Outline updated November 2026

Foundation35 hours delivered over 5-10 daysLive, online or on-site

Request this course

Rust for C# Programmers

Class Duration

35 hours of live training delivered over 5-10 days to accommodate your scheduling needs.

Student Prerequisites

  • Strong working proficiency in modern C# and .NET
  • Comfort with the dotnet CLI, NuGet, and async/await
  • No prior Rust experience required

Target Audience

C# and .NET engineers adding Rust for fast services, native libraries, CLIs, embedded work, or replacements for unmanaged components. It fits teams that have hit GC pause limits or already tune hot paths with Span<T>. Teams continuing on can move to Memory-Safe Programming with Rust and then Rust Parallel Programming.

Description

This course teaches production Rust to experienced C# developers. Each concept is taught against its C# equivalent, such as ownership against the garbage collector and Result against exceptions. Students compare Rust enums with C# union types and closed hierarchies, and Tokio futures with Task. They also compare traits with interfaces, and procedural macros with source generators. The course ends with an async Rust service covering HTTP, JSON, database access, testing, and CI.

Learning Outcomes

  • Write idiomatic Rust using ownership, borrowing, and lifetimes.
  • Map common C# idioms to Rust.
  • Build CLIs, library crates, and async services on Tokio.
  • Use traits and generics where C# uses interfaces and generics.
  • Handle errors with Result<T, E> and ? instead of exceptions.
  • Check AI-generated Rust with the compiler, clippy, and tests.

Training Materials

All students receive comprehensive courseware covering all topics in the course. Courseware is distributed via GitHub in the form of documentation and extensive code samples.

Software Requirements

A free GitHub account, the current stable Rust toolchain via rustup (2024 edition), the .NET 11 SDK for side-by-side C# 15 comparisons, Visual Studio Code or another supported editor with the rust-analyzer extension, and an AI coding assistant of choice (GitHub Copilot, Cursor, or Claude Code). A cloud-based environment can be provided if local installation is restricted.

Training Topics

Introduction: Rust from a C# Perspective

  • Where Rust fits next to C#
  • What the current edition changed
  • Type systems compared
  • Runtime, packaging, and performance
  • The Rust ecosystem

Toolchain and Editor Setup

  • Installing Rust with rustup
  • cargo vs. the dotnet CLI
  • rust-analyzer in VS Code, RustRover, and Zed
  • AI assistants for Rust
  • The Rust Playground

Cargo and Crates

  • cargo new, cargo run, cargo build, cargo test
  • Cargo.toml vs. csproj and NuGet
  • Workspaces and cargo publish --workspace
  • Popular crates such as serde and tokio

Rust vs. C#: A Working Map

  • Ownership and Drop vs. GC and IDisposable
  • Value semantics vs. struct and class
  • Result and ? vs. exceptions
  • Option<T> vs. nullable reference types
  • Structs vs. classes and records
  • Rust enums vs. C# unions
  • Traits vs. interfaces and extension members
  • Monomorphized vs. reified generics
  • Iterators vs. LINQ
  • Tokio futures vs. Task and the TPL

Scalar Types, Control Flow, and Functions

  • Integers, floats, booleans, and characters
  • Constants, statics, and const fn
  • if/else as expressions
  • loop, while, and for
  • let chains in if and while
  • Closures and capture modes

Modules and the Standard Library

  • mod and use
  • Importing from crates.io
  • Visibility and re-exports
  • A standard library tour for C# developers

Built-In Macros

  • println!, eprintln!, format!, and dbg!
  • vec!, assert!, and include_str!
  • cfg!, env!, and panic!

Memory Management and Ownership

  • Ownership, moves, and copies
  • Borrowing with &T and &mut T
  • Slices vs. Span<T> and Memory<T>
  • Borrows vs. ref struct
  • Lifetimes and the borrow checker
  • Box, Rc, and Arc
  • Drop vs. IDisposable and finalizers
  • Shared object graphs, events, and cycles

Strings, Tuples, Enums, Structs, Collections

  • String vs. &str
  • UTF-8 vs. UTF-16 strings
  • Tuples vs. C# tuples
  • Enums with data
  • Option<T> and Result<T, E>
  • Inline variants vs. C# case types
  • Enum layout vs. boxed union contents
  • Default C# unions and null contents
  • Structs, methods, and constructors
  • Rust collections vs. .NET collections
  • Lazy iterators vs. LINQ

Pattern Matching

  • match vs. C# switch expressions
  • Exhaustiveness over unions and closed hierarchies
  • if let, while let, and let chains
  • Destructuring nested data
  • Guards, bindings, and @ patterns

Traits and Generics

  • Defining and implementing traits
  • Default methods and supertraits
  • Trait objects with dyn Trait
  • Traits on existing types vs. extension members
  • Bounds vs. C# generic constraints
  • Static vs. dynamic dispatch
  • Async fn in traits

Async/Await with Tokio

  • Async/await from a Task perspective
  • Lazy futures vs. hot Tasks
  • Choosing and configuring a runtime
  • Dropping futures vs. CancellationToken
  • Async closures
  • tokio::select! and JoinSet
  • HTTP with reqwest
  • JSON with serde
  • Databases with sqlx

Concurrent Programming

  • Threads vs. async tasks
  • Compile-time data-race prevention
  • Arc and Mutex vs. lock and Interlocked
  • Channels vs. System.Threading.Channels
  • rayon vs. Parallel.ForEach and PLINQ

Unsafe Rust

  • unsafe in Rust vs. C#
  • Raw pointers and pointer arithmetic
  • Safe abstractions over unsafe code
  • Auditing unsafe blocks
  • Calling Rust from .NET with P/Invoke

Macros and Metaprogramming

  • Declarative macros with macro_rules!
  • Derive, attribute, and function-like macros
  • syn, quote, and proc-macro2
  • Macros vs. source generators

Tests, Documentation, and Quality

  • Unit, integration, and doc tests
  • Documentation with rustdoc
  • clippy and rustfmt in CI

AI-Assisted Rust Development for .NET Engineers

  • AI tools for Rust work
  • Prompts for ownership and trait design
  • Catching AI mistakes with the compiler
  • Reviewing AI-generated unsafe and unwrap
  • Reflexive Arc<Mutex<T>> in AI code
  • AI-assisted refactors and code review

Private team training

Bring this course to your team

Tell us about your team and we will tailor this outline to your tools, stack, and schedule. Courses can also be combined into a longer program.

  1. Tell us what you needYour tools, stack, team size, and timeline.
  2. We send a proposalA course or program, an outline adjusted to your team, and possible dates.
  3. Your team trains liveOnline or on-site, with courseware for every student.

Prefer to talk? Call +1 434-509-6890 or email help@cloudcontraptions.com.

We reply within 1 business day.

Training partner?