Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6652585
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T01:09:29+00:00 2026-05-26T01:09:29+00:00

I recently started using Lazy throughout my application, and I was wondering if there

  • 0

I recently started using Lazy throughout my application, and I was wondering if there are any obvious negative aspects that I need to take into account when using Lazy<T>?

I am trying to utilize Lazy<T> as often as I deem it appropriate, primarily to help reduce the memory footprint of our loaded, but inactive plugins.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T01:09:30+00:00Added an answer on May 26, 2026 at 1:09 am

    I’ll expand a bit on my comment, which reads:

    I’ve just started using Lazy, and find that it’s often indicative
    of bad design; or laziness on the part of the programmer. Also, one
    disadvantage is that you have to be more vigilant with scoped up
    variables, and create proper closures.

    For example, I’ve used Lazy<T> to create the pages the user can see in my (sessionless) MVC app. It’s a guiding wizard, so the user might want to go to a random previous step. When the handshake is made, an array of Lazy<Page> objects is crated, and if the user specifies as step, that exact page is evaluated. I find it delivers good performance, but there are some aspects to it that I don’t like, for example many of my foreach constructs now look like this:

    foreach(var something in somethings){
         var somethingClosure = something;
         list.Add(new Lazy<Page>(() => new Page(somethingClosure));
    } 
    

    I.e. you have to deal with the problem of closures very proactively. Otherwise I don’t think it’s such a bad performance hit to store a lambda and evaluate it when needed.

    On the other hand this might be indicative that the programmer is being a Lazy<Programmer>, in the sense that you’d prefer not thinking through your program now, and instead let the proper logic evaluate when needed, as with example in my case – instead of building that array, I could just figure out just what that specific requested page would be; but I chose to be lazy, and do an all in approach.

    EDIT

    It occurs to me that Lazy<T> also has a few peculiars when working with concurrency. For example there’s a ThreadLocal<T> for some scenarios, and several flag configurations for your particular multi-threaded scenario. You can read more on msdn.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I recently started using Linux as my primary OS. What are the tools that
I recently started using swing after years of using C# and I was wondering:
I recently started using C# and WPF for one of my projects. Is there
I recently started using WPF and the MVVM framework, one thing that I have
I have recently started using generics in java, and in that attempt tried to
We recently started using Eclipse to develop our java application and have been running
I've recently started using the DynamicQuery API , and it quickly became apparent that
I recently started using Silex. I have been grouping certain functionality of my application
Having recently started using cryptography in my application, I find myself puzzled by the
Hi I recently started using Sencha-touch and I've come to understand that to bend

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.