21 lines
626 B
C#
21 lines
626 B
C#
#nullable enable
|
|
namespace UVC.UI.Commands
|
|
{
|
|
public interface IUndoable
|
|
{
|
|
void Undo(object? parameter = null);
|
|
}
|
|
|
|
public interface IUndoable<T> : ICommand
|
|
{
|
|
void Undo(T parameter);
|
|
|
|
void Undo()
|
|
{
|
|
// CS8604: T가 참조형이고 null이 허용되지 않을 때 경고가 발생하므로,
|
|
// T가 null 허용 타입이거나 값 타입일 때만 default(T)를 전달합니다.
|
|
// 그렇지 않으면, 명시적으로 default(T)를 전달하되, T가 null 허용 타입임을 명시합니다.
|
|
Undo(default(T)!);
|
|
}
|
|
}
|
|
} |