A reader asked for some more information about this line of code:
Transaction t = new Transaction(document,”Modify Mark values”);
What is happening here is that a new Transaction object is being created using the Transaction constructor. The transaction must be associated with a document (you can have several open documents co-existing simultaneously in your Revit API code).
You will also need to give your constructor a name. This can be done when the transaction is created as above, or you can use the constructor that requires only a document and specify the name later using the Transaction.SetName() method. The name of the transaction can be any string that you want. If the transaction is committed (which means that it successfully completed) then the end-user will see the name of the transaction in the Undo menu.
Creating a transaction does not automatically start the transaction. That must be done separately with the Start method. When you are finished with the changes to the model, use the Commit method. Or you can use the Rollback method if you don’t want to commit the changes that were made after starting the transaction.