小编Mak*_*iek的帖子

使用变量作为类型

是否可以使这些代码有效?:

    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
    }
Run Code Online (Sandbox Code Playgroud)

提前致谢

c#

8
推荐指数
1
解决办法
9992
查看次数

NavigationService.navigate空引用异常

我正在学习WP编码,我遇到了无法解决的问题:/

try
 {
    NavigationService.Navigate(new Uri("/edit.xaml", UriKind.Relative));
 }
 catch (Exception ex)
 {
     MessageBox.Show(ex.Message.ToString(),"Error!",MessageBoxButton.OK);
 }
Run Code Online (Sandbox Code Playgroud)

edit.xaml与MainPage.xaml位于同一目录中

它抛出"NullReferenceException"

c# windows-phone-7

1
推荐指数
1
解决办法
5934
查看次数

标签 统计

c# ×2

windows-phone-7 ×1