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. Advertising

  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. Advertising

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:
    476
    Adam Smith
    Apr 15, 2004
  2. Neil Zanella

    initializing static class variables

    Neil Zanella, Jul 30, 2004, in forum: C++
    Replies:
    11
    Views:
    783
    Neil Zanella
    Aug 8, 2004
  3. Replies:
    17
    Views:
    6,461
    Greg Comeau
    Sep 22, 2004
  4. Guest
    Replies:
    0
    Views:
    385
    Guest
    Sep 23, 2004
  5. Phrogz
    Replies:
    4
    Views:
    109
    Trans
    Oct 26, 2006
Loading...

Share This Page