Magnus Mårtensson
Microsoft Regional Director, Azure MVP, CEO Loftysoft
Avirag Jain
Director & CTO R Systems
Mahesh Chand
Founder C# Corner, CEO Mindcracker
Chris Gali
CEO & Co-Founder Graphite
Subinder Khurana
Chief Architect StoryProcess, Founder NASSCOM DeepTech Club
Bryan Rishforth
Investor, Chairman Graphite
Bryn Everson
Director Biz Dev Graphite
Raj Tiwari
Digital Transformation Leader, Futurist and Visionary
Joseph Guadagno
Microsoft MVP, Lead Quicken Loans
Nikita Sachdev
Entrepreneur, Blockchain Enthusiast & Advisor, Social Media Influencer
Doug Wagner
COO & Founder Adapt Technical Group
Ritesh Modi
Architect, Senior Evangelist, Cloud Architect
Crystal Wenrick
Director Communications Mindcracker
Allen O’Neill
Microsoft MVP, Consulting Engineer/Architect
Praveen Kumar
CEO MCN Solutions
Chris Love
Founder Love2Dev, Microsoft MVP, Author
Sanjay Vyas
Microsoft Regional Director, Microsoft MVP, Founder & CEO SkillLabs Technologies
Veena Sarda
Deep Learning Consultant, Author
Sekhar Srinivasan
C# Corner MVP, Microsoft Certified Trainer, Pluralsight Author
Lalit Bansal
Founder & CEO - EIY SYS
Navdeep Garg
CEO Revinfotech
Prakash Tripathi
Tech Manager/Leader, Microsoft MVP, Blogger
Bhavna Jain
Breakthrough Consultant
Naveen Sharma
Enterprise Architect, Leadership Coach, Author
Vidya Vrat Agarwal
Principal Architect, Microsoft MVP, Author
Sheetal Agarwal
Founder Clownselors, Medical Clown, Trainer
Abhishek Kant
Founder GTM Catalyst
Vishnu Saran
Founder & CEO VoiceQube
Sandeep Soni
Founder & CEO Deccansoft, Microsoft Certified Trainer
Parveen Malik
AVP InfoSec & Vulnerability Management, Information Security Expert
Nitin Pandit
Microsoft MVP, Developer Evangelist, Author
Niloshima Srivastava
C# Corner MVP, Tech Architect, Trainer, Blogger
Bala Chirtsabesan
Senior Software Engineer at Microsoft, Author
Manoj Mittal
Sr. Technical Architect, C# Corner MVP, Author
Chandni Di
Co-Founder Voice of Slum
Vithal Wadje
Technical Lead, Microsoft MVP, Author
Shivam Ahuja
Founder SkillCircle, Business Mentor
Chervine Bhiwoo
Solution Architect, Microsoft MVP, Author
Saurabh Jain
Vice President Paytm, Founder Fun2Do Labs, Author
Vinay Solanki
Head IoT at Lenovo, Founder IoT-NCR
Anshu kumari
Founder Blockchainkids, Inventor, Trainer
Amit Singal
CEO Startup Buddy
Dev Pratap
Co-Founder & CEO Voice of Slum
Amey Vartak
Technology Consultant, Full Stack Developer, C# Corner MVP, Author
Viswanatha Swamy
Principal Software Engineer, C# Corner MVP, Author
Sanket Verma
Research Engineer @ Ballistics (Forensics) and Chair, PyData Delhi
Sourabh Somani
Lead Developer, Microsoft MVP, Author
Abhishek Mishra
Software Architect, C# Corner MVP, Author
Siddharth Vaghasia
Technical Consultant, C# Corner MVP, Blogger
Bassam Alugili
Senior Software Specialist, Database Expert
S Ravi Kumar
Solution Architect, C# Corner MVP, Author
Sundaram Subramanian
Full Stack Developer, C# Corner MVP, Speaker
Deepesh Somani
Solution Architect, Microsoft MVP, Author
Debasis Saha
Technical Project Manager, C# Corner MVP, Blogger, Author
Vipul Jain
Software Architect, C# Corner MVP, Author
Akshay Patel
Technical Architect, Microsoft Certified Trainer, C# Corner MVP, Author
Stephen Simon
RPA Developer, Evangelist, Author
Vivek Sharma
Founder Kingster636, AR/VR Specialist
Jeetendra Gund
Technical Lead, C# Corner MVP, Author
Sujal Beniwal
AI Enthusiast, Student
M Viknaraj
Microsoft MVP, Azure Architect, Author
Prasham Sabadra
Software Architect, C# Corner MVP, Trainer, Author
Aakash Maurya
Senior Developer, C# Corner MVP, Speaker
Ankit Sharma
Senior Software Engineer, C# Corner MVP, Author
Mangesh Gaherwar
Team Lead, C# Corner MVP, Author
Viral Jain
Technical Consultant, C# Corner MVP, Author
Bhasker Das
Solution Architect, Evangelist
Manish Dwivedi
Associate Project Manager
Ck Nitin
Programmer, Author
Rohit Gupta
Technical Trainer, Author
Manish Tewatia
Full-stack Marketer, UX Designer
Bhavya Gaur
Technical Illustrator
Rohit Tomar
SEO/SMO Expert
Web Track
Cloud & Data Track
Dev Track
Registration & Breakfast
Future of Desktop Apps with JS (ElectronJs)
Nitin Pandit
Building Serverless Microservices Using Microsoft Azure
Vithal Wadje
Innovating RPA: A Robot for Every Person
Stephen Simon
Managing Cloud Storage Accounts using Logic Apps
Viknaraj Manogararajah
Data visualization using Python
Sekhar Srinivasan
Going Cross platform with AR Foundation
Vivek Sharma
Keynote
Managing your Azure dependencies in ASP.NET Core apps using VS
Bala Chirtsabesan
Securing Applications on Intelligent Azure
Abhishek Mishra
Getting started with Blazor the Framework of Future
S Ravi Kumar
Lunch
Build Progressive Web Apps using Angular 9
Debasis Saha
Build and deploy to any platform using Azure DevOps
Chervine Bhiwoo
Deep Dive in Azure Service Bus
Akshay Patel
Build a Native Mobile Application using React Native and JavaScript
Joseph Guadagno
Making sense of Web Job, Web Job SDK and Functions in Azure
Prakash Tripathi
CloudFront Distribution in AWS
Viral Jain
Tea Break
Introduction to PowerBI
Aakash Maurya
Build Advanced SPFx solutions with React and Graph API
Siddharth Vaghasia
Build Business Intelligence Analyst (BIA) Skills
Sundaram Subramanian
Deep dive of Power Platform – AI BUILDER
Prasham Sabadra
Panel 1
What's new in SharePoint development
Vipul Jain
Build a SSO (Single Sign On) based Native JavaScript application with Microsoft Identity within 10 minutes
Manoj Mittal
Panel 2
Applications and working of AI
Veena Sarda
Deploying serverless API's with .Net core 3.0 on AWS & Azure
Amey Vartak
Panel 3
Blockchain with .NET Core (Ark)
Anshu Kumari
Closing Note & Prize Distribution
Dev Track
Cloud Track
Architecture Track
Emerging Tech Track
Registration & Breakfast
Creating Full-Stack Web Apps Using Server-Side Blazor
Ankit Sharma
Real time face recognition with MS Cognitive Services
Niloshima Srivastava
Building Scalable APIs with GraphQL
Jeetendra Gund
Future of development with AI and Blockchain
Navdeep Garg
Debugging Tips and Tricks with Visual Studio 2019
Joseph Guadagno
Azure Containers
Abhishek Kant
Enterprise Architecture
Naveen Sharma
Bot Framework - learn it fast and look like a boss!
Allen O’Neill
Keynote
.Net Core & C# 8 Performance
David McCarter
Working with Azure kubernetes services
Ritesh Modi
Becoming an Architect
Vidyavrat Agarwal
Why Techies Need to Learn Product Management
Saurabh Jain
Lunch
Build a rules engine in .Net Core
Sanjay Vyas
Building CI and CD Pipeline using Azure DevOps
Sandeep Soni
Entity Framework Core - Tips and Tricks, Performance Optimization, and Tuning
Bassam Alugili
Hacking your way into Data Science
Sanket Verma
Speed up your .Net Core Website
Sourabh Somani
Azure
Magnus Mårtensson
Demystifying Open Distro for Elasticsearch
Suman Debnath
Future of Data
Shivam Ahuja
Tea Break
gRPC with C# and .Net Core
Mangesh Gaherwar
Panel 1
Essentials of Cloud security
Parveen Malik
Power platform and Dynamics 365
Deepesh Somani
Microservices - the gRPC Way
Viswanatha Swamy
Panel 2
Reserved
Reserved
Closing Note & Prize Distribution
Implementing the command pattern in C# for undoable operations
Software systems that let users reverse their last action are often taken for granted until that feature disappears. The command pattern, one of the classic GoF behavioural patterns, provides an elegant way to model reversible behaviour in C# by turning each request into a self-contained object. Conference attendees who work on line-of-business tools, financial dashboards, or content editors will recognise the pattern's value: every operation carries both the means to perform itself and the means to roll itself back.
This piece walks through the design, the C# code, and the supporting history mechanism that lets an application undo and redo actions reliably. Along the way, examples are drawn from scenarios familiar to Australian developers: invoice editors used by Sydney accounting firms, telemetry dashboards maintained in Melbourne, and field-data capture tools deployed in regional Queensland.
Understanding the command pattern's core participants
The pattern decouples the object that issues a request from the object that knows how to execute it. Five participants collaborate: the Command interface declaring Execute and Undo methods; concrete command classes that bind a receiver to a set of actions; the receiver itself, which owns the business logic and state; the invoker, which asks the command to run and stores it for later reversal; and the client, which assembles everything together.
By representing each action as an object, you can queue, log, serialise, replay, or undo it without changing the invoker. This is precisely what undoable workflows demand. A common mental shortcut is to think of the command object as a thin envelope around a method call, but the envelope matters: it captures the receiver, the arguments, and the inverse operation, which together allow the action to be reversed cleanly even after the original execution context has long vanished.
For Australian teams building software subject to the Australian Privacy Principles, the pattern has another quiet benefit. Because each command is a discrete record of what was requested, who requested it, and when, an audit trail can be assembled from the command log itself rather than retrofitted onto the domain model.
Designing a small but realistic C# example
Consider a simple text editor that needs to support character insertions and deletions with undo support. A straightforward ICommand interface sets the contract.
public interface ICommand
{
void Execute();
void Undo();
}
Each concrete command stores the receiver (the editor), the character affected, and the inverse data needed to reverse the change. An InsertCommand, for instance, remembers the character and its index, then on Undo deletes exactly that character at exactly that location. A DeleteCommand remembers the character it removed and re-inserts it at the recorded position. The receiver stays ignorant of any command machinery and continues to expose only Append, RemoveAt, and Length methods.
The Invoker in this design is typically a stack-backed history manager. The application's user interface calls invoker.Run(command), which both calls Execute and pushes the command onto an undo stack. When the user presses Ctrl+Z, the invoker pops the top command, calls Undo, and pushes the command onto a redo stack. Ctrl+Y reverses the process. Because each command object carries everything needed to undo itself, the Invoker never has to know about the receiver's internal layout, which keeps coupling low.
A subtle but important detail in C# is the use of immutable snapshots inside commands. Storing the original character value rather than a reference to a mutable buffer ensures that undo remains correct even if the buffer is later reassigned. Many Australian software houses have learned this the hard way, particularly when integrating with legacy VB6 components still common in certain Commonwealth departments.
Storing and replaying command history
A naive history might simply keep a List<ICommand>, but that breaks down once redo enters the picture. The classic data structure is two stacks: undo and redo. Running a new command clears the redo stack, since the new action invalidates any future that was being built. Bounded stacks, such as a circular buffer of the last fifty actions, prevent memory bloat in long-running sessions like point-of-sale terminals in Brisbane retail outlets during end-of-financial-year rushes.
For more advanced scenarios, commands can be persisted to durable storage. Australian financial software operating under APRA's CPS 234 information-security standard often serialises command objects to an append-only log so that audits can reconstruct exactly which balance change happened, when, and by whose request. The same machinery also enables crash recovery: on startup, the application replays the log to bring state back to its last consistent point.
When commands need to be combined into a single reversible unit, a CompositeCommand wraps several ICommand instances and routes Execute and Undo to each child. This is particularly handy for multi-step forms, such as the GST-adjustment screens used during the Australian financial year closing in late June, where one user gesture must atomically adjust several ledgers.
Edge cases, testing, and integration with MVVM
Three edge cases repeatedly trip up developers. First, commands that fail partially must be designed so that Undo restores prior state even when Execute threw midway; a try/catch around the body, paired with compensating Undo logic, is the usual answer. Second, asynchronous commands introduce timing hazards; awaiting Execute and capturing the result before pushing onto the undo stack keeps the history consistent. Third, undo of an action that itself triggers another command (such as a macro) requires the macro to push its child commands as a single composite so that one Ctrl+Z reverses the whole sequence.
Testing undoable workflows benefits from property-based techniques: generate random command sequences, execute them, undo them all, and assert that the resulting state equals the initial state. This approach has become standard practice in Melbourne's fintech scene, where teams building budgeting apps for the Australian market must demonstrate that complex multi-account transfers revert cleanly.
In MVVM or Blazor applications, the Invoker is usually injected into a view-model, and the view-model exposes Undo and Redo methods that the UI binds to. Commands are constructed inside the view-model so they can capture references to observable properties, which is a cleaner alternative to passing them in from the code-behind. The pattern also composes well with the mediator and chain-of-responsibility patterns when a single gesture fans out to several subsystems.
Choosing between command, memento, and event sourcing
Several alternatives exist for reversible behaviour, each with trade-offs worth weighing.
| Approach | Captures | Memory profile | Best fit | Drawback |
|---|---|---|---|---|
| Command with undo stack | Inverse operation per action | Light, grows with action count | Editors, forms, transactional UIs | Inverse logic must be written for every command |
| Memento | Full state snapshots | Heavy, grows with state size | Small object graphs, occasional undo | Snapshots can become large; serialisation overhead |
| Event sourcing | Every state change as an event | Light per event, heavy overall | Audit-heavy domains, financial ledgers | Replay cost; eventual consistency considerations |
| Command + memento hybrid | Operation plus pre-state snapshot | Moderate | Complex domain where inverses are hard to write | More moving parts to test |
For most line-of-business applications in Australia, the plain command-with-undo-stack approach is the right starting point. Add memento snapshots only when the inverse operation is genuinely difficult to author. Reach for event sourcing when regulatory drivers such as APRA prudential standards, the Australian Privacy Principles, or sector-specific record-keeping rules make a full audit log mandatory.
A few practical habits sharpen any implementation, and a few signals hint that an alternative pattern may suit a given module better.
Habits and signals worth keeping close
- Keep ICommand free of framework dependencies so commands remain unit-testable in isolation.
- Make Undo idempotent so repeated presses of Ctrl+Z after a single undo are safe.
- Bound the history stack to a sensible depth, then expose it for diagnostics.
- Use composite commands for any user gesture that touches more than one aggregate.
When to consider a different pattern:
- Switch to memento snapshots when inverse logic becomes harder to maintain than the snapshot itself.
- Switch to event sourcing when ATO-aligned audit retention exceeds a few years or cross-system reconciliation is required.
- Reach for a hybrid when command scope is wide and state is small enough to snapshot cheaply.
The command pattern rewards careful design with features that users expect and developers rarely think about until they are missing. A well-modelled undo history is one of the quieter signs of a mature C# codebase.
1, CBD, Maharaj Surajmal Road, Near Yamuna Sports Complex, Delhi, 110032
GENERAL QUERIES
Manish Tewatia
manish@csharpcon.com
+91-9718-431-042
TICKET QUERIES
Atul Gupta
conference@csharpcon.com
+91-9910-125-804