Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7170499
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T15:13:32+00:00 2026-05-28T15:13:32+00:00

The Memento Pattern itself seems pretty straight forward. I’m considering implementing the same as

  • 0

The Memento Pattern itself seems pretty straight forward. I’m considering implementing the same as the wikipedia example, but before I do are there any language features of C# that make it easier to implement or use?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T15:13:33+00:00Added an answer on May 28, 2026 at 3:13 pm

    One obvious feature would be generics, implementing an generic memento will allow you to use it for any object you want.

    Many examples that you will see will use a string (including all those currently among the replies to this question) as state which is a problem since it’s one of the few types in .NET which are immutable.

    When dealing with mutable objects (like any reference type with a setter-property) you have to remember though that when you save the memento you need to create a deepcopy of the object. Otherwise whenever you change your original object you will change your memento.

    You could do this by using a serializer like protobuf-net or json.net since they don’t require you to mark your objects with serializable attribute like the normal .net serialization mechanism does.

    Codeproject have few articles about generic memento implementations, but they tend to skip the deepcopy part:

    Generic Memento Pattern for Undo-Redo in C#

    Memento Design Pattern

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

What is the best having when implementing Memento pattern (for Undo/Redo) in witch collection
I have a C# project in which I use the Memento/Command pattern to implement
I'm looking for a JavaScript implementation of the memento pattern (GoF) to be used
With the memento design pattern, is it wrong to have the Caretaker as an
I am wanting to implement a Memento pattern in a game for the purpose
I use the Memento Pattern to save properties of a multi-instance form, where n
What are the differences between DTO pattern (by Fowler) and Memento pattern (by GoF)
I've noticed that getting started with design patterns is pretty difficult for beginners. Understanding
I found a similar post here but I can't solve the problem anyway. I
I have a C++ application designed according to a classic Model-View-Controller pattern . The

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.