VB.NET:带有Option Strict On的匿名类型应使用哪个As子句? [英] VB.NET: Which As clause to use with anonymous type with Option Strict On?

查看:108
本文介绍了VB.NET:带有Option Strict On的匿名类型应使用哪个As子句?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

考虑始终声明Option Strict On的要求.我们总是需要使用As关键字声明变量.匿名类型是什么类型?

Consider the requirement to always declare Option Strict On. We'll always need to declare variables with the As keyword. What would be the type of an anonymous type?

示例:Dim product As ... = New With { Key .Name = "paperclips", .Price = 1.29 }

As将遵循什么?

推荐答案

尝试在类顶部或项目级别设置Option Infer On

try either setting Option Infer On at the top of the class or a project level

这篇关于VB.NET:带有Option Strict On的匿名类型应使用哪个As子句?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆