Click here to Skip to main content
15,891,951 members
Please Sign up or sign in to vote.
3.00/5 (4 votes)
See more:
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.
Posted
Updated 4-Feb-17 18:44pm
Comments
Kenneth Haugland 15-Aug-12 8:52am    
Name?
Sergey Alexandrovich Kryukov 15-Aug-12 20:32pm    
Of course it is assigned during run time. Please see my solution, especially after [EDIT].
But main part of it -- this is incorrect question.
--SA
Zoltán Zörgő 15-Aug-12 9:14am    
Does not change or can't be changed?
Sergey Alexandrovich Kryukov 15-Aug-12 20:33pm    
Good point. The question is quite incorrect, by the reasons I explain in my answer -- please see.
--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.

[EDIT]

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
 
Share this answer
 
v4
Comments
Abdul Quader Mamun 15-Aug-12 21:21pm    
greatly Answered!
Sergey Alexandrovich Kryukov 15-Aug-12 21:30pm    
Thank you, Abdul.
--SA
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):
VB
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
If I had to pick a single one out of them, I would go for Handle.
 
Share this answer
 
Comments
Abdul Quader Mamun 15-Aug-12 21:21pm    
hard Work!
Lock, Generate Member & Modifiers properties are not changed at run time because this properties can be modified/changed at design time only.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900