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

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

    What is thread safety?

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

    A thread safety question

    Simon Harvey, Aug 6, 2004, in forum: ASP .Net
    Replies:
    3
    Views:
    406
    Alvin Bruney [MVP]
    Aug 6, 2004
  4. =?Utf-8?B?Sm9l?=

    Literal vs. LiteralControl vs. Label

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

    Difference between UI.LiteralControl and WebControls.Literal ?

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

Share This Page