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. .NET 2.0 features

.NET 2.0 features

Scheduled Pinned Locked Moved The Lounge
csharpc++comarchitecturequestion
43 Posts 17 Posters 0 Views 1 Watching
  • 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.
  • C Offline
    C Offline
    Christian Graus
    wrote on last edited by
    #1

    I'm interested ( in light of the post below ) to know how many people have taken to the new 2.0 features ? We all use typed containers, I am sure, but how often do you use an anonymous method or iterators ? As I said on that thread, I used my first anonymous method, because it struck me as the ideal solution as I worked on it, before it's never seemed appropriate. I wonder if I'm just not in the habit yet, or this was truly the first time they were the right tool for the job. I love the idea of iterators, but I don't think I've used them in production code yet, and I imagine I need to look out for chances to change my mindset to be using them. How about you ?

    Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

    E C M C S 10 Replies Last reply
    0
    • C Christian Graus

      I'm interested ( in light of the post below ) to know how many people have taken to the new 2.0 features ? We all use typed containers, I am sure, but how often do you use an anonymous method or iterators ? As I said on that thread, I used my first anonymous method, because it struck me as the ideal solution as I worked on it, before it's never seemed appropriate. I wonder if I'm just not in the habit yet, or this was truly the first time they were the right tool for the job. I love the idea of iterators, but I don't think I've used them in production code yet, and I imagine I need to look out for chances to change my mindset to be using them. How about you ?

      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

      E Offline
      E Offline
      El Corazon
      wrote on last edited by
      #2

      Christian Graus wrote:

      How about you ?

      ".Net wasn't designed for me."

      _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

      J 1 Reply Last reply
      0
      • E El Corazon

        Christian Graus wrote:

        How about you ?

        ".Net wasn't designed for me."

        _________________________ Asu no koto o ieba, tenjo de nezumi ga warau. Talk about things of tomorrow and the mice in the ceiling laugh. (Japanese Proverb)

        J Offline
        J Offline
        Jorgen Sigvardsson
        wrote on last edited by
        #3

        "I wasn't designed for .NET" :rolleyes:

        -- Torn from tomorrow's headlines

        A 1 Reply Last reply
        0
        • J Jorgen Sigvardsson

          "I wasn't designed for .NET" :rolleyes:

          -- Torn from tomorrow's headlines

          A Offline
          A Offline
          Anton Afanasyev
          wrote on last edited by
          #4

          "We're of incompatible versions"

          J 1 Reply Last reply
          0
          • A Anton Afanasyev

            "We're of incompatible versions"

            J Offline
            J Offline
            Jorgen Sigvardsson
            wrote on last edited by
            #5

            "I'm unmanagable"

            -- Now with chucklelin

            C R 2 Replies Last reply
            0
            • C Christian Graus

              I'm interested ( in light of the post below ) to know how many people have taken to the new 2.0 features ? We all use typed containers, I am sure, but how often do you use an anonymous method or iterators ? As I said on that thread, I used my first anonymous method, because it struck me as the ideal solution as I worked on it, before it's never seemed appropriate. I wonder if I'm just not in the habit yet, or this was truly the first time they were the right tool for the job. I love the idea of iterators, but I don't think I've used them in production code yet, and I imagine I need to look out for chances to change my mindset to be using them. How about you ?

              Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

              C Offline
              C Offline
              Clickok
              wrote on last edited by
              #6

              My hopes in .Net 2.0 was Generics BUT... I wished create some type like MyBox Now I wish a collection of MyBox objects, but I can't. I can have only a collection of MyBox, MyBox, etc, but not of "MyBox" :doh: Another problem is the ?? operator and the Nullable notation (int?, string?, etc). How I can have problems using these together, I ever use Nullable instead... I will use iterators when I have nothing more important to do... The only thing what I use and abuse is the provider model (membership, sitemap, etc). But have the problem what is developed to read configurations of the web.config. If you wish use in Windows Forms, will be needed a lot of work to read from app.config (I have mentioned, what even if you use class libraries, you need referencing things like System.Web.Configuration, Syste.Web.Security, etc) This is my points and rants :) -- modified at 19:39 Monday 14th August, 2006 Jesus is Love! Tell to someone! :-)

              J J 2 Replies Last reply
              0
              • J Jorgen Sigvardsson

                "I'm unmanagable"

                -- Now with chucklelin

                C Offline
                C Offline
                Clickok
                wrote on last edited by
                #7

                "Access Violation" or better "NullReferenceException"


                Jesus is Love! Tell to someone! :-)

                1 Reply Last reply
                0
                • C Christian Graus

                  I'm interested ( in light of the post below ) to know how many people have taken to the new 2.0 features ? We all use typed containers, I am sure, but how often do you use an anonymous method or iterators ? As I said on that thread, I used my first anonymous method, because it struck me as the ideal solution as I worked on it, before it's never seemed appropriate. I wonder if I'm just not in the habit yet, or this was truly the first time they were the right tool for the job. I love the idea of iterators, but I don't think I've used them in production code yet, and I imagine I need to look out for chances to change my mindset to be using them. How about you ?

                  Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                  M Offline
                  M Offline
                  Marc Clifton
                  wrote on last edited by
                  #8

                  Christian Graus wrote:

                  but how often do you use an anonymous method or iterators

                  I'm not sure what "good code practices" are for anonymous methods, I just figure that it would be for a line or two of code, and this is the first time I've had something that met that requirement. As to iterators, I have yet to write my own iterator or type the word "yield". That's probably because of the nature of the code I write, rather than whatever kind of code you write that would leverage iterators. I use partial classes a lot, because it keeps the source file smaller. And typed containers, like you said, are everywhere. Marc

                  XPressTier

                  Some people believe what the bible says. Literally. At least [with Wikipedia] you have the chance to correct the wiki -- Jörgen Sigvardsson
                  People are just notoriously impossible. --DavidCrow
                  There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer

                  J 1 Reply Last reply
                  0
                  • C Christian Graus

                    I'm interested ( in light of the post below ) to know how many people have taken to the new 2.0 features ? We all use typed containers, I am sure, but how often do you use an anonymous method or iterators ? As I said on that thread, I used my first anonymous method, because it struck me as the ideal solution as I worked on it, before it's never seemed appropriate. I wonder if I'm just not in the habit yet, or this was truly the first time they were the right tool for the job. I love the idea of iterators, but I don't think I've used them in production code yet, and I imagine I need to look out for chances to change my mindset to be using them. How about you ?

                    Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                    C Offline
                    C Offline
                    Chris Maunder
                    wrote on last edited by
                    #9

                    Generics, obviously. Iterators not yet, mainly because the built in collection classes already do what I need. Nullable types? I want to since they match up with nullable fields in databases so nicely, but the effort involved in retrofitting what I currently have just makes me cringe. It'll happen next clean-up iteration, but not today. And anonymous methods? To me they are like the DataSource control in ASP.NET. They let you get something done quickly and without needing to bother anyone else, but they just scream out "quick and dirty" to me. Give the code the respect of at least having a name and a place to live.

                    cheers, Chris Maunder

                    CodeProject.com : C++ MVP

                    M C 2 Replies Last reply
                    0
                    • C Christian Graus

                      I'm interested ( in light of the post below ) to know how many people have taken to the new 2.0 features ? We all use typed containers, I am sure, but how often do you use an anonymous method or iterators ? As I said on that thread, I used my first anonymous method, because it struck me as the ideal solution as I worked on it, before it's never seemed appropriate. I wonder if I'm just not in the habit yet, or this was truly the first time they were the right tool for the job. I love the idea of iterators, but I don't think I've used them in production code yet, and I imagine I need to look out for chances to change my mindset to be using them. How about you ?

                      Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                      S Offline
                      S Offline
                      Shog9 0
                      wrote on last edited by
                      #10

                      Anonymous methods for event handlers that consist of one or two lines. It always irritated me to have to pollute the class namespace with those, so it works out nicely.

                      ---- Scripts i’ve known... CPhog 1.8.2 - make CP better. Forum Bookmark 0.2.5 - bookmark forum posts on Pensieve Print forum 0.1.2 - printer-friendly forums Expand all 1.0 - Expand all messages In-place Delete 1.0 - AJAX-style post delete Syntax 0.1 - Syntax highlighting for code blocks in the forums

                      1 Reply Last reply
                      0
                      • C Chris Maunder

                        Generics, obviously. Iterators not yet, mainly because the built in collection classes already do what I need. Nullable types? I want to since they match up with nullable fields in databases so nicely, but the effort involved in retrofitting what I currently have just makes me cringe. It'll happen next clean-up iteration, but not today. And anonymous methods? To me they are like the DataSource control in ASP.NET. They let you get something done quickly and without needing to bother anyone else, but they just scream out "quick and dirty" to me. Give the code the respect of at least having a name and a place to live.

                        cheers, Chris Maunder

                        CodeProject.com : C++ MVP

                        M Offline
                        M Offline
                        Marc Clifton
                        wrote on last edited by
                        #11

                        Chris Maunder wrote:

                        Nullable types

                        Nullable types are utterly useless, IMHO, because they have no correspondence to DBNull.Value, which is what I care about. Marc

                        XPressTier

                        Some people believe what the bible says. Literally. At least [with Wikipedia] you have the chance to correct the wiki -- Jörgen Sigvardsson
                        People are just notoriously impossible. --DavidCrow
                        There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer

                        C J 2 Replies Last reply
                        0
                        • M Marc Clifton

                          Chris Maunder wrote:

                          Nullable types

                          Nullable types are utterly useless, IMHO, because they have no correspondence to DBNull.Value, which is what I care about. Marc

                          XPressTier

                          Some people believe what the bible says. Literally. At least [with Wikipedia] you have the chance to correct the wiki -- Jörgen Sigvardsson
                          People are just notoriously impossible. --DavidCrow
                          There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer

                          C Offline
                          C Offline
                          Clickok
                          wrote on last edited by
                          #12

                          Marc Clifton wrote:

                          Nullable types are utterly useless, IMHO, because they have no correspondence to DBNull.Value, which is what I care about

                          I Agree :mad:


                          Jesus is Love! Tell to someone! :-)

                          1 Reply Last reply
                          0
                          • C Christian Graus

                            I'm interested ( in light of the post below ) to know how many people have taken to the new 2.0 features ? We all use typed containers, I am sure, but how often do you use an anonymous method or iterators ? As I said on that thread, I used my first anonymous method, because it struck me as the ideal solution as I worked on it, before it's never seemed appropriate. I wonder if I'm just not in the habit yet, or this was truly the first time they were the right tool for the job. I love the idea of iterators, but I don't think I've used them in production code yet, and I imagine I need to look out for chances to change my mindset to be using them. How about you ?

                            Christian Graus - Microsoft MVP - C++ Metal Musings - Rex and my new metal blog

                            J Offline
                            J Offline
                            J Dunlap
                            wrote on last edited by
                            #13

                            Generics, anonymous methods, yield, DynamicMethod, static and partial classes, separate visibility levels for property accessors, delegate co/contravariance, Marshal.GetDelegateForFunctionPointer(), debugger visualizers - I've used all of those and more. .NET 2.0 is :cool: !

                            M C 2 Replies Last reply
                            0
                            • J J Dunlap

                              Generics, anonymous methods, yield, DynamicMethod, static and partial classes, separate visibility levels for property accessors, delegate co/contravariance, Marshal.GetDelegateForFunctionPointer(), debugger visualizers - I've used all of those and more. .NET 2.0 is :cool: !

                              M Offline
                              M Offline
                              Marc Clifton
                              wrote on last edited by
                              #14

                              J. Dunlap wrote:

                              delegate co/contravariance

                              What's that?

                              J. Dunlap wrote:

                              Marshal.GetDelegateForFunctionPointer(),

                              When do you use that?

                              J. Dunlap wrote:

                              debugger visualizers

                              Are these things you've written, or using the visualizers already in the debugger?

                              J. Dunlap wrote:

                              separate visibility levels for property accessors

                              Ah, I forgot about that!

                              J. Dunlap wrote:

                              DynamicMethod

                              Say, do you have those dynamic property setters folded into MyXaml yet? ;P Marc

                              XPressTier

                              Some people believe what the bible says. Literally. At least [with Wikipedia] you have the chance to correct the wiki -- Jörgen Sigvardsson
                              People are just notoriously impossible. --DavidCrow
                              There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer

                              J C 2 Replies Last reply
                              0
                              • M Marc Clifton

                                J. Dunlap wrote:

                                delegate co/contravariance

                                What's that?

                                J. Dunlap wrote:

                                Marshal.GetDelegateForFunctionPointer(),

                                When do you use that?

                                J. Dunlap wrote:

                                debugger visualizers

                                Are these things you've written, or using the visualizers already in the debugger?

                                J. Dunlap wrote:

                                separate visibility levels for property accessors

                                Ah, I forgot about that!

                                J. Dunlap wrote:

                                DynamicMethod

                                Say, do you have those dynamic property setters folded into MyXaml yet? ;P Marc

                                XPressTier

                                Some people believe what the bible says. Literally. At least [with Wikipedia] you have the chance to correct the wiki -- Jörgen Sigvardsson
                                People are just notoriously impossible. --DavidCrow
                                There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer

                                J Offline
                                J Offline
                                J Dunlap
                                wrote on last edited by
                                #15

                                Marc Clifton wrote:

                                What's that?

                                Co/contravariance is where the return type or argument types of the method that a delegate wraps don't have to be the exact same types as declared in the delegate signature. The return type on the method can be a type derived from the delegate's return type, and the arguments can be a less specific type than those declared in the delegate signature.

                                //Covariance:
                                public delegate Control CovarianceExampleDelegate;

                                public class CovarianceExample
                                {
                                    Form GetForm()
                                    {
                                        ...
                                    }

                                void Example()
                                    {
                                         //CovarianceExampleDelegate's declared type is Control, but we can create an instance of it
                                         //based on the GetForm() method because GetForm's return type is derived from
                                         //CovarianceExampleDelegate's return type
                                         CovarianceExampleDelegate d = GetForm;
                                    }
                                }

                                //Contravariance:
                                public delegate void ContravarianceExampleDelegate(string s);
                                public class ContravarianceExample
                                {
                                    void Add(object o)
                                    {
                                        //...
                                    }
                                   
                                    void Example()
                                    {
                                         //Add()'s argument type is 'object' rather than 'string', but this works because 'string' is
                                         //derived from 'object'
                                         ContravarianceExampleDelegate d = Add;
                                    }
                                }

                                Marc Clifton wrote:

                                When do you use that? [Marshal.GetDelegateForFunctionPointer()]

                                I used it to dynamically call a method in a C-style DLL without declaring the P/Invoke sig at compile time. You can also do things like execute raw machine code.

                                Marc Clifton wrote:

                                Are these things you've written, or using the visualizers already in the debugger?

                                I wrote a GraphicsPath visualizer and a Bitmap visualizer.

                                Marc Clifton wrote:

                                Say, do you have those dynamic property setters folded

                                1 Reply Last reply
                                0
                                • C Clickok

                                  My hopes in .Net 2.0 was Generics BUT... I wished create some type like MyBox Now I wish a collection of MyBox objects, but I can't. I can have only a collection of MyBox, MyBox, etc, but not of "MyBox" :doh: Another problem is the ?? operator and the Nullable notation (int?, string?, etc). How I can have problems using these together, I ever use Nullable instead... I will use iterators when I have nothing more important to do... The only thing what I use and abuse is the provider model (membership, sitemap, etc). But have the problem what is developed to read configurations of the web.config. If you wish use in Windows Forms, will be needed a lot of work to read from app.config (I have mentioned, what even if you use class libraries, you need referencing things like System.Web.Configuration, Syste.Web.Security, etc) This is my points and rants :) -- modified at 19:39 Monday 14th August, 2006 Jesus is Love! Tell to someone! :-)

                                  J Offline
                                  J Offline
                                  Jorgen Sigvardsson
                                  wrote on last edited by
                                  #16

                                  click.ok wrote:

                                  MyBox objects

                                  If generics are anything like C++ templates, then MyBox is not a type, and can therefore not have any instances. Generics/templates are in essence copy'n'paste mechanisms requiring no actual copy'n'paste. :)

                                  -- Torn from tomorrow's headlines

                                  J 1 Reply Last reply
                                  0
                                  • M Marc Clifton

                                    Christian Graus wrote:

                                    but how often do you use an anonymous method or iterators

                                    I'm not sure what "good code practices" are for anonymous methods, I just figure that it would be for a line or two of code, and this is the first time I've had something that met that requirement. As to iterators, I have yet to write my own iterator or type the word "yield". That's probably because of the nature of the code I write, rather than whatever kind of code you write that would leverage iterators. I use partial classes a lot, because it keeps the source file smaller. And typed containers, like you said, are everywhere. Marc

                                    XPressTier

                                    Some people believe what the bible says. Literally. At least [with Wikipedia] you have the chance to correct the wiki -- Jörgen Sigvardsson
                                    People are just notoriously impossible. --DavidCrow
                                    There's NO excuse for not commenting your code. -- John Simmons / outlaw programmer

                                    J Offline
                                    J Offline
                                    Jorgen Sigvardsson
                                    wrote on last edited by
                                    #17

                                    Marc Clifton wrote:

                                    As to iterators, I have yet to write my own iterator or type the word "yield". That's probably because of the nature of the code I write, rather than whatever kind of code you write that would leverage iterators.

                                    I haven't written a line of code using the yield stuff. But from what I can tell, it does have potential for clever patterns. Do you know if yield can handle non-linear collections such as dictionaries?

                                    -- Made From Meat By-Products

                                    J 1 Reply Last reply
                                    0
                                    • J Jorgen Sigvardsson

                                      click.ok wrote:

                                      MyBox objects

                                      If generics are anything like C++ templates, then MyBox is not a type, and can therefore not have any instances. Generics/templates are in essence copy'n'paste mechanisms requiring no actual copy'n'paste. :)

                                      -- Torn from tomorrow's headlines

                                      J Offline
                                      J Offline
                                      J Dunlap
                                      wrote on last edited by
                                      #18

                                      Generics are more than just copy-and-paste mechanisms - they are special "incomplete" types whose "type slots" are filled in dynamically at JIT time with the types specified in code that uses specific instances of them. When people use a specific version of a generic type in their code, what it is bound against is an actual compiled type in the assembly, with all the metadata, versioning, and other features of a normal type. You can even use reflection to create a specific instance of a generic type at runtime without having to specify the type arguments at compile time. This makes generics ideal for dynamic code gen and dynamic binding purposes.

                                      C J 2 Replies Last reply
                                      0
                                      • J J Dunlap

                                        Generics are more than just copy-and-paste mechanisms - they are special "incomplete" types whose "type slots" are filled in dynamically at JIT time with the types specified in code that uses specific instances of them. When people use a specific version of a generic type in their code, what it is bound against is an actual compiled type in the assembly, with all the metadata, versioning, and other features of a normal type. You can even use reflection to create a specific instance of a generic type at runtime without having to specify the type arguments at compile time. This makes generics ideal for dynamic code gen and dynamic binding purposes.

                                        C Offline
                                        C Offline
                                        Clickok
                                        wrote on last edited by
                                        #19

                                        Do you understood my pain :^):zzz:


                                        Jesus is Love! Tell to someone! :-)

                                        1 Reply Last reply
                                        0
                                        • J J Dunlap

                                          Generics are more than just copy-and-paste mechanisms - they are special "incomplete" types whose "type slots" are filled in dynamically at JIT time with the types specified in code that uses specific instances of them. When people use a specific version of a generic type in their code, what it is bound against is an actual compiled type in the assembly, with all the metadata, versioning, and other features of a normal type. You can even use reflection to create a specific instance of a generic type at runtime without having to specify the type arguments at compile time. This makes generics ideal for dynamic code gen and dynamic binding purposes.

                                          J Offline
                                          J Offline
                                          Jorgen Sigvardsson
                                          wrote on last edited by
                                          #20

                                          Still copy'n'paste in my book. :) List == IntList, List == StringList. Semantically, wherever you can put a List, you can put an IntList. The obvious benefit with the generics is that you don't have tio write all the methods (Append(), Delete(), etc) for each and every type you want to use. Ok, so I'll meet you halfway; it's copy'n'link for you, but copy'n'paste for the compiler/linker/JIT (it still has to "copy" for each new instantiation of the generic). :)

                                          -- [LIVE] From Omicron Persei 8

                                          J 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