textbox属性在运行时不会更改 [英] textbox property not change at runtime

查看:164
本文介绍了textbox属性在运行时不会更改的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好......



i有一个问题,就是在面试时问我的特定问题找到最佳答案。我的问题如下: 。



文本框的哪个属性在运行时不会改变。



所以请回答这个问题。



提前预付款。

hello everyone...

i have a problem to find best answer for a given problem that is asked me in interview..my question is as bellow...

which property of textbox doesn't change at runtime.

so please answer this question.

thanx in advance.

推荐答案

这些采访者的这个问题是如此愚蠢,以至于让它变得棘手:-)

(天哪,为什么这么多面试问题都是愚蠢的?不是因为人们认为没有人记录他们吗?有人这么做。我的尊重。)



现在,该属性不是一个字段。那么他们所说的不改变需要一些定义;这就是诀窍。当调用属性getter时,属性的值会立即显示。它可能涉及一些计算,特别是它可能只是读取一些支持字段(请参阅 http://en.wikipedia.org/wiki/Property_%28programming%29 [ ^ ])。



现在,支持字段几乎总是在运行时至少修改一次什么时候初始化。这是否意味着该财产被修改?是和否。



如果你提出这样的问题:是否可以两次读取属性值并获得不同的结果?这个问题归因于这个问题。







以防万一,我也想要破坏一些只在设计时才改变一些属性的神话。在应用程序生命周期中,没有设计时,这是Visual Studio进程生命周期的一部分。如果查看Designer自动生成的代码,您将看到所有分配中的硬编码。此代码在运行时,在构造函数中调用。因此,使用Designer分配的所有实际上将在运行时分配。



(此前所有解决方案都是错误的,原因是我希望在下面解释。)



[结束编辑]



我称这样的问题是空洞的。通过指向某些成员来回答这些问题是雇用开发人员的一个非常糟糕的标准。我宁愿雇用一个为什么被拒绝回答这个问题的人,特别是这种拒绝是有动机的。当然,当我问这个人我的问题之后。 :-)



-SA
This question of these interviewers is so idiotic that it makes it tricky :-)
(Gosh, why so many interview questions are idiotic? Isn't that because people think that nobody records them? Some do. My respect.)

Now, the property is not a field. So what do they mean by "not change" need some definition; and this is the trick. The value of the property appears on the fly, when the property getter is called. It can involve some calculation, and, in particular, it could be just reading of some backing field (please see http://en.wikipedia.org/wiki/Property_%28programming%29[^]).

Now, the backing field is almost always modified during run time at least once when it is initialized. Does it mean that the property is modified? Yes and no.

If you formulate the question like that: "is it possible to read the property value twice and get different results?" that would be a certain meaning attributed to the question.



Just in case, I also want to bust the myth that some properties are changed only during design time. In the application life cycle, there is no "design time", this is a part of Visual Studio process life time. If you look at the code auto-generated by the Designer, you will see all your assignments hard-coded in it. And this code is called during run-time, in a constructor. So everything assigned using the Designer will actually be assigned during run time.

(All solutions prior to this one are wrong, by the reasons I hopefully explained below.)

[END EDIT]

I call such question empty-minded. Answering them by pointing to some members is a very bad criterion for hiring a developer. I would rather hired the one why denied to answer the question, especially this denial is motivated. After I asked this person my questions, of course. :-)

—SA


取决于申请。

在大多数应用程序中,有大量属性不会改变;永远不会从默认值更改,即使设计了teh表单。这些包括(但不限于):

Depends on the application.
In most applications there are a large number of properties that don't change; that are never changed from the default value, even when teh form is designed. These include (but are not limited to):
Name
AcceptsReturn
AcceptsTab
AccessibilityObject
AccessibleDefaultActionDescription
AccessibleDescription
AccessibleName
AccessibleRole
AllowDrop
AutoCompleteCustomSource
AutoCompleteMode
AutoCompleteSource
AutoScrollOffset
AutoSize
BackColor
BackgroundImage
BackgroundImageLayout
BindingContext
BorderStyle
CanEnableIme
CanFocus
CanRaiseEvents
CanSelect
CanUndo
Capture
CausesValidation
CharacterCasing
Container
ContainsFocus
ContextMenu
ContextMenuStrip
Created
Cursor
DataBindings
DefaultCursor
DefaultImeMode
DefaultMargin
DefaultMaximumSize
DefaultMinimumSize
DefaultPadding
DefaultSize
DesignMode
DoubleBuffered
Font
FontHeight
ForeColor
Handle
HasChildren
HideSelection
Multiline
Padding
Parent
PasswordChar
PreferredHeight
PreferredSize
RecreatingHandle
RenderRightToLeft
ResizeRedraw
RightToLeft
ScaleChildren
TabIndex
TabStop
UseSystemPasswordChar
UseWaitCursor

如果我必须选择一个,我会选择Handle。

If I had to pick a single one out of them, I would go for Handle.


锁定,生成成员&修饰符属性在运行时不会更改,因为此属性只能在设计时修改/更改。
Lock, Generate Member & Modifiers properties are not changed at run time because this properties can be modified/changed at design time only.


这篇关于textbox属性在运行时不会更改的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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