Diff
checker
Testo
Testo
Immagini
Documenti
Excel
Cartelle
Legal
Enterprise
Applicazione per desktop
Prezzi
Accedi
Scarica Diffchecker Desktop
Confronta il testo
Trova la differenza tra due file di testo
Strumenti
Cronologia
Editor live
Comprimi invariate
Senza a capo
Layout
Diviso
Unificato
Livello di dettaglio
Intelligente
Parola
Carattere
Evidenziazione sintassi
Scegli sintassi
Ignora
Trasforma testo
Vai alla prima modifica
Modifica input
Diffchecker Desktop
Il modo più sicuro per usare Diffchecker. Ottieni l'app Diffchecker Desktop: i tuoi diff non lasciano mai il tuo computer!
Ottieni Desktop
Async Task vs Async void
Creato
2 anni fa
Il diff non scade mai
Eliminare
Esporta
Condividere
Spiegare
11 rimozioni
Linee
Totale
Rimosso
Caratteri
Totale
Rimosso
Per continuare a utilizzare questa funzione, aggiorna a
Diff
checker
Pro
Visualizza prezzi
80 linee
Copia tutti
8 aggiunte
Linee
Totale
Aggiunto
Caratteri
Totale
Aggiunto
Per continuare a utilizzare questa funzione, aggiorna a
Diff
checker
Pro
Visualizza prezzi
78 linee
Copia tutti
public class MyClass
public class MyClass
{
{
[CompilerGenerated]
[CompilerGenerated]
Copia
Copiato
Copia
Copiato
private sealed class <
NormalAsync
>d__0 : IAsyncStateMachine
private sealed class <
AsyncVoid
>d__0 : IAsyncStateMachine
{
{
public int <>1__state;
public int <>1__state;
Copia
Copiato
Copia
Copiato
public Async
Task
MethodBuilder <>t__builder;
public Async
Void
MethodBuilder <>t__builder;
public MyClass <>4__this;
public MyClass <>4__this;
private YieldAwaitable.YieldAwaiter <>u__1;
private YieldAwaitable.YieldAwaiter <>u__1;
private void MoveNext()
private void MoveNext()
{
{
int num = <>1__state;
int num = <>1__state;
try
try
{
{
YieldAwaitable.YieldAwaiter awaiter;
YieldAwaitable.YieldAwaiter awaiter;
if (num != 0)
if (num != 0)
{
{
awaiter = Task.Yield().GetAwaiter();
awaiter = Task.Yield().GetAwaiter();
if (!awaiter.IsCompleted)
if (!awaiter.IsCompleted)
{
{
num = (<>1__state = 0);
num = (<>1__state = 0);
<>u__1 = awaiter;
<>u__1 = awaiter;
Copia
Copiato
Copia
Copiato
<
NormalAsync
>d__0 stateMachine = this;
<
AsyncVoid
>d__0 stateMachine = this;
<>t__builder.AwaitUnsafeOnCompleted(ref awaiter, ref stateMachine);
<>t__builder.AwaitUnsafeOnCompleted(ref awaiter, ref stateMachine);
return;
return;
}
}
}
}
else
else
{
{
awaiter = <>u__1;
awaiter = <>u__1;
<>u__1 = default(YieldAwaitable.YieldAwaiter);
<>u__1 = default(YieldAwaitable.YieldAwaiter);
num = (<>1__state = -1);
num = (<>1__state = -1);
}
}
awaiter.GetResult();
awaiter.GetResult();
}
}
catch (Exception exception)
catch (Exception exception)
{
{
<>1__state = -2;
<>1__state = -2;
<>t__builder.SetException(exception);
<>t__builder.SetException(exception);
return;
return;
}
}
<>1__state = -2;
<>1__state = -2;
<>t__builder.SetResult();
<>t__builder.SetResult();
}
}
void IAsyncStateMachine.MoveNext()
void IAsyncStateMachine.MoveNext()
{
{
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
//ILSpy generated this explicit interface implementation from .override directive in MoveNext
this.MoveNext();
this.MoveNext();
}
}
[DebuggerHidden]
[DebuggerHidden]
private void SetStateMachine([Nullable(1)] IAsyncStateMachine stateMachine)
private void SetStateMachine([Nullable(1)] IAsyncStateMachine stateMachine)
{
{
}
}
void IAsyncStateMachine.SetStateMachine([Nullable(1)] IAsyncStateMachine stateMachine)
void IAsyncStateMachine.SetStateMachine([Nullable(1)] IAsyncStateMachine stateMachine)
{
{
//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine
//ILSpy generated this explicit interface implementation from .override directive in SetStateMachine
this.SetStateMachine(stateMachine);
this.SetStateMachine(stateMachine);
}
}
}
}
Copia
Copiato
Copia
Copiato
[NullableContext(1)]
[AsyncStateMachine(typeof(<
AsyncVoid
>d__0))]
[AsyncStateMachine(typeof(<
NormalAsync
>d__0))]
[DebuggerStepThrough]
[DebuggerStepThrough]
Copia
Copiato
Copia
Copiato
public
Task NormalAsync
()
public
void AsyncVoid
()
{
{
Copia
Copiato
Copia
Copiato
<
NormalAsync
>d__0 stateMachine = new <
NormalAsync
>d__0();
<
AsyncVoid
>d__0 stateMachine = new <
AsyncVoid
>d__0();
stateMachine.<>t__builder = Async
Task
MethodBuilder.Create();
stateMachine.<>t__builder = Async
Void
MethodBuilder.Create();
stateMachine.<>4__this = this;
stateMachine.<>4__this = this;
stateMachine.<>1__state = -1;
stateMachine.<>1__state = -1;
stateMachine.<>t__builder.Start(ref stateMachine);
stateMachine.<>t__builder.Start(ref stateMachine);
Copia
Copiato
Copia
Copiato
return stateMachine.<>t__builder.Task;
}
}
}
}
Diff salvati
Testo originale
Apri file
public class MyClass { [CompilerGenerated] private sealed class <NormalAsync>d__0 : IAsyncStateMachine { public int <>1__state; public AsyncTaskMethodBuilder <>t__builder; public MyClass <>4__this; private YieldAwaitable.YieldAwaiter <>u__1; private void MoveNext() { int num = <>1__state; try { YieldAwaitable.YieldAwaiter awaiter; if (num != 0) { awaiter = Task.Yield().GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; <NormalAsync>d__0 stateMachine = this; <>t__builder.AwaitUnsafeOnCompleted(ref awaiter, ref stateMachine); return; } } else { awaiter = <>u__1; <>u__1 = default(YieldAwaitable.YieldAwaiter); num = (<>1__state = -1); } awaiter.GetResult(); } catch (Exception exception) { <>1__state = -2; <>t__builder.SetException(exception); return; } <>1__state = -2; <>t__builder.SetResult(); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine([Nullable(1)] IAsyncStateMachine stateMachine) { } void IAsyncStateMachine.SetStateMachine([Nullable(1)] IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } [NullableContext(1)] [AsyncStateMachine(typeof(<NormalAsync>d__0))] [DebuggerStepThrough] public Task NormalAsync() { <NormalAsync>d__0 stateMachine = new <NormalAsync>d__0(); stateMachine.<>t__builder = AsyncTaskMethodBuilder.Create(); stateMachine.<>4__this = this; stateMachine.<>1__state = -1; stateMachine.<>t__builder.Start(ref stateMachine); return stateMachine.<>t__builder.Task; } }
Testo modificato
Apri file
public class MyClass { [CompilerGenerated] private sealed class <AsyncVoid>d__0 : IAsyncStateMachine { public int <>1__state; public AsyncVoidMethodBuilder <>t__builder; public MyClass <>4__this; private YieldAwaitable.YieldAwaiter <>u__1; private void MoveNext() { int num = <>1__state; try { YieldAwaitable.YieldAwaiter awaiter; if (num != 0) { awaiter = Task.Yield().GetAwaiter(); if (!awaiter.IsCompleted) { num = (<>1__state = 0); <>u__1 = awaiter; <AsyncVoid>d__0 stateMachine = this; <>t__builder.AwaitUnsafeOnCompleted(ref awaiter, ref stateMachine); return; } } else { awaiter = <>u__1; <>u__1 = default(YieldAwaitable.YieldAwaiter); num = (<>1__state = -1); } awaiter.GetResult(); } catch (Exception exception) { <>1__state = -2; <>t__builder.SetException(exception); return; } <>1__state = -2; <>t__builder.SetResult(); } void IAsyncStateMachine.MoveNext() { //ILSpy generated this explicit interface implementation from .override directive in MoveNext this.MoveNext(); } [DebuggerHidden] private void SetStateMachine([Nullable(1)] IAsyncStateMachine stateMachine) { } void IAsyncStateMachine.SetStateMachine([Nullable(1)] IAsyncStateMachine stateMachine) { //ILSpy generated this explicit interface implementation from .override directive in SetStateMachine this.SetStateMachine(stateMachine); } } [AsyncStateMachine(typeof(<AsyncVoid>d__0))] [DebuggerStepThrough] public void AsyncVoid() { <AsyncVoid>d__0 stateMachine = new <AsyncVoid>d__0(); stateMachine.<>t__builder = AsyncVoidMethodBuilder.Create(); stateMachine.<>4__this = this; stateMachine.<>1__state = -1; stateMachine.<>t__builder.Start(ref stateMachine); } }
Trovare la differenza