Questa può sembrare una domanda stupida, ma come faccio a creare una variabile Func<>
che non restituisce nulla?Func non restituisce nulla?
7
A
risposta
14
È possibile utilizzare Action<T>
per un delegato che accetta una variabile e restituisce void
.
Tuttavia, è possibile anche dichiarare i propri tipi di delegati se lo si desidera. Action<T>
, per esempio, è solo
public delegate void Action<T>(T obj)
4
Sarà l'azione < T lavoro > delegato per voi?
3
Si consiglia:
Action<T> a = (t) => // your code here...
Problemi correlati
- 1. JSON.getString non restituisce nulla
- 2. non restituisce nulla
- 3. non restituisce nulla. Perché?
- 4. Perché GetFields() non restituisce nulla?
- 5. Unity 'GetAllInstances' non restituisce nulla
- 6. dequeueReusableCellWithIdentifier non restituisce mai nulla
- 7. perché getLastRequest non restituisce nulla?
- 8. Get-AzureVM restituisce nulla
- 9. NSNumberFormatter.stringFromNumber restituisce mai nulla?
- 10. Trigger PostgreSQL che non restituisce nulla
- 11. Print_r non restituisce nulla; var_dump mostra NULL
- 12. La descrizione dell'istanza E2C non restituisce nulla
- 13. InPlaceBitmapMetadataWriter.TrySave() restituisce true ma non fa nulla
- 14. getAccountsByType non restituisce nulla in marshmallow
- 15. comando bower che non restituisce nulla
- 16. non restituisce nulla dalla funzione postgresql?
- 17. jquery css ("border-color") non restituisce nulla
- 18. Perché indexPathForItemAtPoint restituisce sempre nulla
- 19. Come usare textview.getLayout()? Restituisce nulla
- 20. Relazione CoreData davvero semplice ma restituisce nulla e nulla?
- 21. Lo script PowerShell non restituisce nulla sull'esecuzione di IIS
- 22. L'host dell'indirizzo del server Expressjs non restituisce nulla
- 23. [PHP]: Cosa restituisce array_search() se non è stato trovato nulla?
- 24. Come creare una funzione che non restituisce nulla
- 25. AudioConverter # FillComplexBuffer restituisce -50 e non converte nulla
- 26. https://graph.facebook.com/me/albums a volte non restituisce nulla
- 27. Incoerenza dei dati principali - il recupero talvolta non restituisce nulla
- 28. BitmapFactory.decodeFile restituisce un'immagine ancora nulla esiste
- 29. Come si dichiara un Delegato Func che restituisce un Delegato Func dello stesso tipo?
- 30. TimeZoneInfo.ConvertTime non Convertire nulla
Non lo so ma è necesary a USEA delegato sarà lo scopo non risolto da solo facendo il tipo come void il ritorno –
Non è possibile specificare void (o Void) come argomento di tipo. –
ma la domanda riguarda il tipo di reso non per gli agrumi –