是否可以从构造函数块中的QueryString获取值? [英] Is that possible to get the value from QueryString in constructor block?

查看:99
本文介绍了是否可以从构造函数块中的QueryString获取值?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

类似的东西;



Something like that ;

public SampleConstructor ()
      {
          InitializeComponent();
         string ID=QueryString["ID"].ToString();
}

推荐答案

我不明白为什么你不能这样做但我不认为这是一个很好的设计。



我宁愿创建一个参数化构造函数并将id传递给它。
I don''t see why you can''t do this but I don''t think that''s a good design.

I would rather create a parameterised constructor and pass the id to it.


这篇关于是否可以从构造函数块中的QueryString获取值?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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