gpt4 book ai didi

c# - 使用变量作为类型

转载 作者:太空狗 更新时间:2023-10-29 19:45:06 24 4
gpt4 key购买 nike

<分区>

是否有可能使这样的代码工作?:

    private List<Type> Models = new List<Type>()
{
typeof(LineModel), typeof(LineDirectionModel), typeof(BusStopTimeModel), typeof(BusStopNameModel)
};

foreach (Type model in Models) // in code of my method
{
Connection.CreateTable<model>(); // error: 'model' is a variable but is used like a type
}

提前致谢

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com