Initializing variables in a class

Discussion in 'ASP .Net' started by =?Utf-8?B?ZG90bmV0dGVzdGVy?=, Nov 23, 2005.

  1. I have two constructors, one that takes a string parameter and another with
    no parameters.

    I want initialize one instance variable from a value defined in web.config
    file.

    My question is where I place the code for instance variable initialization?
    in both of the constructors?
     
    =?Utf-8?B?ZG90bmV0dGVzdGVy?=, Nov 23, 2005
    #1
    1. Advertisements

  2. You could, or you can create a helper method that both constructors call, or
    you can call one constructor from the other.

    "dotnettester" <> wrote in message
    news:...
    >I have two constructors, one that takes a string parameter and another with
    > no parameters.
    >
    > I want initialize one instance variable from a value defined in web.config
    > file.
    >
    > My question is where I place the code for instance variable
    > initialization?
    > in both of the constructors?
     
    Peter Rilling, Nov 23, 2005
    #2
    1. Advertisements

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Adam Smith
    Replies:
    0
    Views:
    567
    Adam Smith
    Apr 15, 2004
  2. E11
    Replies:
    1
    Views:
    5,757
    Thomas Weidenfeller
    Oct 12, 2005
  3. Neil Zanella

    initializing static class variables

    Neil Zanella, Jul 30, 2004, in forum: C++
    Replies:
    11
    Views:
    946
    Neil Zanella
    Aug 8, 2004
  4. Replies:
    17
    Views:
    7,272
    Greg Comeau
    Sep 22, 2004
  5. Guest
    Replies:
    1
    Views:
    545
    Ron Natalie
    Sep 23, 2004
  6. Burton Samograd

    Initializing defaults to module variables

    Burton Samograd, Apr 12, 2006, in forum: Python
    Replies:
    6
    Views:
    370
    Burton Samograd
    Apr 13, 2006
  7. Replies:
    9
    Views:
    1,319
  8. Phrogz
    Replies:
    4
    Views:
    186
    Trans
    Oct 26, 2006
Loading...