LiteralControl thread safety.

Discussion in 'ASP .Net' started by George Ter-Saakov, Apr 5, 2004.

  1. Hi.

    I have template solution. The Base page creates the main skeleton for the
    page.

    For that it adds bunch of LiteralControls in run time.

    I am thinking of creating those controls only once(during initialization)
    and then just add them to control collection.

    I realize that every instance of the page will use the same instance of the
    LiteralControl but since they only have static text i think it will be OK
    and will save me some CPU ticks.

    Is it ok? Any problem with this approach?

    Thanks.
    George.
     
    George Ter-Saakov, Apr 5, 2004
    #1
    1. Advertisements

  2. Hi, George,

    It will be easier to answer your question if you post some code.

    Basically, everything that is not static (in VB shared) or constant field
    gets created for each instance of the class. With the inheritance you avoid
    writing the same code many times, but the code gets executed anyway.

    Greetings
    Martin
    "George Ter-Saakov" <> wrote in message
    news:...
    > Hi.
    >
    > I have template solution. The Base page creates the main skeleton for the
    > page.
    >
    > For that it adds bunch of LiteralControls in run time.
    >
    > I am thinking of creating those controls only once(during initialization)
    > and then just add them to control collection.
    >
    > I realize that every instance of the page will use the same instance of

    the
    > LiteralControl but since they only have static text i think it will be OK
    > and will save me some CPU ticks.
    >
    > Is it ok? Any problem with this approach?
    >
    > Thanks.
    > George.
    >
    >
     
    Martin Dechev, Apr 6, 2004
    #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. Hans

    What is thread safety?

    Hans, Oct 11, 2004, in forum: ASP .Net
    Replies:
    1
    Views:
    701
    Sahil Malik
    Oct 12, 2004
  2. Andreas Klemt
    Replies:
    1
    Views:
    1,639
    Showjumper
    Jan 3, 2004
  3. Simon Harvey

    A thread safety question

    Simon Harvey, Aug 6, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    524
    Alvin Bruney [MVP]
    Aug 6, 2004
  4. thechaosengine

    Thread safety when subclassing the Page class

    thechaosengine, Dec 10, 2004, in forum: ASP .Net
    Replies:
    2
    Views:
    467
    Scott Allen
    Dec 10, 2004
  5. =?Utf-8?B?RGlmZmlkZW50?=

    Thread-safety and Singleton methods

    =?Utf-8?B?RGlmZmlkZW50?=, Jan 13, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    672
    Karl Seguin
    Jan 13, 2005
  6. =?Utf-8?B?RmVuZw==?=

    Thread safety issue

    =?Utf-8?B?RmVuZw==?=, Jun 15, 2005, in forum: ASP .Net
    Replies:
    1
    Views:
    523
    Bruce Barker
    Jun 16, 2005
  7. =?Utf-8?B?Sm9l?=

    Literal vs. LiteralControl vs. Label

    =?Utf-8?B?Sm9l?=, Nov 11, 2005, in forum: ASP .Net
    Replies:
    7
    Views:
    51,444
    feddas
    Dec 30, 2008
  8. Andreas Klemt

    Difference between UI.LiteralControl and WebControls.Literal ?

    Andreas Klemt, Jan 3, 2004, in forum: ASP .Net Web Controls
    Replies:
    3
    Views:
    896
    Alessandro Zifiglio
    Jan 4, 2004
Loading...