Re: asp.net, C#, constructor in new class
- From: "Lau Lei Cheong" <leu_lc@xxxxxxxxxxxx>
- Date: Fri, 12 May 2006 11:37:58 +0800
You may have a constructor which accepts a string as parameter to make it
reusable on other places (compatible for exposing read-only property of the
string so others can't change it once the object is created), or have a
empty constructor and a property that let you change that value. It's
basically a choice of designing how you want to make it work.
Empty constructor is legal of course, just meaning this class won't do any
custom initialization when it's created.
And I don't prefer to have control names explicitly coded into classes other
than the webform itself, to preserve reusability and code cleaness.
"Ranginald" <davidwank@xxxxxxxxx>
???????:1147404246.389709.192310@xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I am learning C# and asp.net and am trying to create a new utility
class.
The default code you get from vwd express is:
/// <summary>
/// Summary description for ddlCode
/// </summary>
public class someClass
{
public someClass()
{
//
// TODO: Add constructor logic here
//
}
}
If I have a method, for example txtBoxSubmit, that assigns a variable
(string txtData) from txtBox.text, where do I put that code in the
above scaffold? Can it have an empty constructor?
Thanks!
.
- Follow-Ups:
- Re: asp.net, C#, constructor in new class
- From: Ranginald
- Re: asp.net, C#, constructor in new class
- References:
- asp.net, C#, constructor in new class
- From: Ranginald
- asp.net, C#, constructor in new class
- Prev by Date: asp.net, C#, constructor in new class
- Next by Date: RE: Control properties are not enabled
- Previous by thread: asp.net, C#, constructor in new class
- Next by thread: Re: asp.net, C#, constructor in new class
- Index(es):
Relevant Pages
|