草庐IT

TryGetAsync

全部标签

c# - 为模式匹配解构元组

给定一个函数asyncTaskTryGetAsync(),我能行if((awaitTryGetAsync())isvarret&&ret.result){//useret.value}但是,如果我尝试使用声明类型或使用解构,则会出现错误“在此上下文中不允许声明”://declaration.errorif((awaitTryGetAsync())is(Booleanresult,MyObjectvalue)ret&&ret.result){//useret.value}//deconstruction,alsoerror.if((awaitTryGetAsync())is(Boolea