Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. The Lounge
  3. It's too hot to be motivated

It's too hot to be motivated

Scheduled Pinned Locked Moved The Lounge
csharplinqtoolsworkspace
15 Posts 8 Posters 581 Views
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • R Offline
    R Offline
    Ron Nicholson
    wrote on last edited by
    #5

    Ah the memories. Glad it is finally up.
    and witch it gives you something to do in your unmotivated state.

    1 Reply Last reply
    2
    • code-witchC code-witch

      @Sander-Rossel It's good to finally hear from you, especially since you've been scolding me in my head about my code off and on in absentia since codeproject went dark. XD

      Sander RosselS Offline
      Sander RosselS Offline
      Sander Rossel
      wrote on last edited by
      #6

      @code-witch said in It's too hot to be motivated:

      @Sander-Rossel It's good to finally hear from you, especially since you've been scolding me in my head about my code off and on in absentia since codeproject went dark. XD

      Good to hear I've become another voice in your head. Thanks for letting me stay there rent free!
      And it's good to see you back too, I wouldn't know who to scold otherwise and things just wouldn't be the same ;D

      code-witchC 1 Reply Last reply
      0
      • Sander RosselS Sander Rossel

        @code-witch said in It's too hot to be motivated:

        @Sander-Rossel It's good to finally hear from you, especially since you've been scolding me in my head about my code off and on in absentia since codeproject went dark. XD

        Good to hear I've become another voice in your head. Thanks for letting me stay there rent free!
        And it's good to see you back too, I wouldn't know who to scold otherwise and things just wouldn't be the same ;D

        code-witchC Offline
        code-witchC Offline
        code-witch
        wrote on last edited by
        #7

        @Sander-Rossel I've got whole new coding horrors for you. like my extension method .ToLazyList() that works off an IEnumerable<T> and is every bit as horrible as it appears. XD

        K Sander RosselS 2 Replies Last reply
        1
        • code-witchC code-witch

          @Sander-Rossel I've got whole new coding horrors for you. like my extension method .ToLazyList() that works off an IEnumerable<T> and is every bit as horrible as it appears. XD

          K Offline
          K Offline
          kmoorevs
          wrote on last edited by
          #8

          @code-witch Have you seen some of the old haunts that they've re-opened? Soap Box, Back Room, Clever Code...that last one sounds perfect! Good to see everyone is getting back! :)

          1 Reply Last reply
          1
          • code-witchC code-witch

            @Sander-Rossel I've got whole new coding horrors for you. like my extension method .ToLazyList() that works off an IEnumerable<T> and is every bit as horrible as it appears. XD

            Sander RosselS Offline
            Sander RosselS Offline
            Sander Rossel
            wrote on last edited by Sander Rossel
            #9

            @code-witch
            IEnumerable<T> ToLazyList<T>(this IEnumerable<T> collection)
            {
            // TODO: Finish later, feeling lazy rn.
            return collection;
            }

            1 Reply Last reply
            1
            • C Offline
              C Offline
              CharHen
              wrote last edited by
              #10

              @code-witch
              List<T> is an IEnumerable<T> so we could simplify as IEnumerable<T> ToLazyList<T>(this IEnumerable<T> collection) => new List<T>(collection);

              honey the codewitchH 1 Reply Last reply
              0
              • C CharHen

                @code-witch
                List<T> is an IEnumerable<T> so we could simplify as IEnumerable<T> ToLazyList<T>(this IEnumerable<T> collection) => new List<T>(collection);

                honey the codewitchH Offline
                honey the codewitchH Offline
                honey the codewitch
                wrote last edited by
                #11

                @CharHen Nope. That doesn't do the same thing. That creates a copy of the data. You may as well use ToList<>()

                C 1 Reply Last reply
                0
                • honey the codewitchH honey the codewitch

                  @CharHen Nope. That doesn't do the same thing. That creates a copy of the data. You may as well use ToList<>()

                  C Offline
                  C Offline
                  CharHen
                  wrote last edited by
                  #12

                  @honey-the-codewitch Gotcha! we could do IEnumerable<T> ToLazyList<T>(this IEnumerable<T> collection) {foreach(var item in collection){yield return item;}}

                  Richard DeemingR 1 Reply Last reply
                  0
                  • C CharHen

                    @honey-the-codewitch Gotcha! we could do IEnumerable<T> ToLazyList<T>(this IEnumerable<T> collection) {foreach(var item in collection){yield return item;}}

                    Richard DeemingR Offline
                    Richard DeemingR Offline
                    Richard Deeming
                    wrote last edited by
                    #13

                    @CharHen which would be a slightly less efficient version of:

                    IEnumerable<T> ToLazyList<T>(this IEnumerable<T> collection) => collection;
                    

                    Your version just wraps another IEnumerable<T> implementation around the one that's passed in.

                    "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                    1 Reply Last reply
                    1
                    • C Offline
                      C Offline
                      CharHen
                      wrote last edited by
                      #14

                      It pulls from the source using a new iterator but creates a state machine for the iterator. If the source is lazy, for example, a linq query, the wrapper will be lazy also.

                      Richard DeemingR 1 Reply Last reply
                      0
                      • C CharHen

                        It pulls from the source using a new iterator but creates a state machine for the iterator. If the source is lazy, for example, a linq query, the wrapper will be lazy also.

                        Richard DeemingR Offline
                        Richard DeemingR Offline
                        Richard Deeming
                        wrote last edited by
                        #15

                        @CharHen Yes; as I said, it wraps the existing enumerable in another enumerable state machine, which adds nothing except a slight performance hit.

                        Making it a slightly less efficient option than just using the source enumerable directly.

                        "These people looked deep within my soul and assigned me a number based on the order in which I joined" - Homer

                        1 Reply Last reply
                        0
                        Reply
                        • Reply as topic
                        Log in to reply
                        • Oldest to Newest
                        • Newest to Oldest
                        • Most Votes


                        • Login

                        • Don't have an account? Register

                        • Login or register to search.
                        • First post
                          Last post
                        0
                        • Categories
                        • Recent
                        • Tags
                        • Popular
                        • World
                        • Users
                        • Groups