For each Method i want create Sync and Async, But without duplicating the code. I f I call an Async Method with other Async Methods inside, is it a correct code?.
public void MethodA(){//1
MethodAAsync().GetAwaiter();
}
public void MethodA(){//2 is it a correct code
MethodB();
MethodC();
...code
...code
...code
MethodD();
MethodE();
}
public async Task MethodAAsync(){
await MethodBAsync(cancellationToken);
await MethodCAsync(cancellationToken);
...code
...code
...code
await MethodDAsync(cancellationToken);
await MethodEAsync(cancellationToken);
}
//1 or 2