谁能向我解释以下代码? [英] Can anyone explain to me about the following code?

查看:78
本文介绍了谁能向我解释以下代码?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

String tempStr1 = "";
String.Format("{1} ", "", Request["Name"]);
   Display.Text = tempStr1;



非常感谢.



Thanks a lot.

推荐答案

// create a temporary string containing no characters
String tempStr1 = "";
// format a string containing the contents of a field called Name,
// but don't save the new string anywhere
String.Format("{1} ", "", Request["Name"]);
// set the text content of variable Display to the string tempStr1
// which is nothing
   Display.Text = tempStr1;


该代码不会在Display控件中显示任何内容.
如果按以下方式进行更改,则可以从"Display"控件的请求中获取"Name"-

That code would display nothing in the Display control.

If you change it as follows you will get the "Name" from your request in the "Display" control-

String tempStr1 = "";
tempStr1 = String.Format("Hi {0}!", Request["Name"]);
   Display.Text = tempStr1;



使用上面的代码,如果Request["Name"]"noname89757",则"Display"控件将显示"Hi noname89757!"



Using the abouve code, if Request["Name"] is "noname89757" then "Display" control would display "Hi noname89757!"


这篇关于谁能向我解释以下代码?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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