Class ReversibleChange
This class contains the information to undo a change in the project database. Undoing a change is done by reflection. So we need an object, the name of a method or a property and the parameters to use in the call. This information must be provided in the constructor. The method or property must have public access.
Inherited Members
Namespace: CADability
Assembly: CADability.dll
Syntax
public class ReversibleChange
Constructors
| Improve this Doc View SourceReversibleChange(Object, String, Object[])
Creates a ReversibleChange object. MethodOrPropertyName must be the name (casesensitive!) of a public method or property that reverses the change when called with the parameters given in the parameter "Parameter". If parameters contains exactly 1 object, the Undo method will first look for a set-property with that type to reverse the change. If there is no set-property with that name and type then the system will look for a method with this single parameter.
Declaration
public ReversibleChange(object objectToChange, string methodOrPropertyName, params object[] parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | objectToChange | The object which will be or was changed |
| System.String | methodOrPropertyName | the case sensitive name of the method or property |
| System.Object[] | parameters | The parameters neede to call this method or property |
ReversibleChange(Object, Type, String, Object[])
Creates a ReversibleChange object. MethodOrPropertyName must be the name (casesensitive!) of a public method or property that reverses the change when called with the parameters given in the parameter "Parameter". If parameters contains exactly 1 object, the Undo method will first look for a set-property with that type to reverse the change. If there is no set-property with that name and type then the system will look for a method with this single parameter.
Declaration
public ReversibleChange(object objectToChange, Type interfaceForMethod, string methodOrPropertyName, params object[] parameters)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | objectToChange | The object which will be or was changed |
| System.Type | interfaceForMethod | the interface on which contains the method or property |
| System.String | methodOrPropertyName | the case sensitive name of the method or property |
| System.Object[] | parameters | The parameters neede to call this method or property |
Properties
| Improve this Doc View SourceMethodOrPropertyName
Gets the method or property name for this ReversibleChange
Declaration
public string MethodOrPropertyName { get; }
Property Value
| Type | Description |
|---|---|
| System.String |
ObjectToChange
Gets the objects which is changed by this ReversibleChange
Declaration
public object ObjectToChange { get; }
Property Value
| Type | Description |
|---|---|
| System.Object |
Parameters
Gets the parameters, that can be used in the method call of this ReversibleChange
Declaration
public object[] Parameters { get; }
Property Value
| Type | Description |
|---|---|
| System.Object[] |
Methods
| Improve this Doc View SourceIsMethod(String)
Checks whether this ReversibleChange ist a method with the given name
Declaration
public bool IsMethod(string methodName)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | methodName | The name of the method |
Returns
| Type | Description |
|---|---|
| System.Boolean | true, if methodName is the name of the ReversibleChange method |
ToString()
Overrides objec.ToString()
Declaration
public override string ToString()
Returns
| Type | Description |
|---|---|
| System.String | the call for the undo as a string |
Overrides
Undo()
Declaration
public bool Undo()
Returns
| Type | Description |
|---|---|
| System.Boolean |