Re: asp.net, C#, constructor in new class

Tech-Archive recommends: Fix windows errors by optimizing your registry



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!



.



Relevant Pages

  • Re: a method to make js have the ability to inherit
    ... but without the implied type-conversion of the string ... that uses the name of a specific constructor. ... programmer has no idea at all what types of object they are ... no reason for ever doing so. ...
    (comp.lang.javascript)
  • Re: Newbie question: Writing your own class
    ... is made by a class's Create constructor method which allocates memory ... FDefinition: string; ... every other descendant of TObject ... Result:= FDefinition; ...
    (comp.lang.pascal.delphi.misc)
  • Re: About speed
    ... property Name: String read fName; ... constructor TProperty.Create; ... fValue: PropertyOfT_DataType; ... constructor Create(other: TPropertyOfT); overload; ...
    (borland.public.delphi.non-technical)
  • Re: a method to make js have the ability to inherit
    ... discriminating but without the implied type-conversion of the string ... makes no use of an object's - constructor - property anyway.) ... programs should serve some known purpose known to the programmer. ... var o = Father.prototype; ...
    (comp.lang.javascript)
  • Re: regex into str
    ... people confronted with it to reject python as language. ... Don't get me wrong - there is a lot of decisions to be made in language ... The only thing you really need is a simple constructor for your undoubtly ... Overloading "" as the string ...
    (comp.lang.python)