기본 클래스에서 비동기는 아니지만 파생 클래스에서 비동기 인 가상 메서드를 정의하고 호출자가 대리자를 사용하여 호출합니다 (실제로는 단추로 활성화 된 ICommand입니다. 화면에서) 어떻게하면됩니까?메트로 C에서 가상 비동기 메서드 #
public class BaseClass
{
BIONESSBindingCommand mLogoffCommand;
public ICommand LogoffCommand
{
get
{
if (mLogoffCommand == null)
{
mLogoffCommand = new BIONESSBindingCommand(
Param => Logoff(), //Command DoWork
Param => true); //Always can execute
}
return mLogoffCommand;
}
}
public virtual Task Logoff()
{
DoLogoff();
return null; //???
}
}
public class DerivedClass : BaseClass
{
public override async Task Logoff()
{
await SomeWoAsyncWork();
base.Logoff(); //Has warninngs
}
}
생성자 내부에서 속성과 메서드를 지정하는 경우를 제외하고는 제대로 작동하지 않습니까? –