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. Other Discussions
  3. The Weird and The Wonderful
  4. Microsoft.Sharepoint.dll

Microsoft.Sharepoint.dll

Scheduled Pinned Locked Moved The Weird and The Wonderful
csharpsharepointcomtutorialquestion
6 Posts 4 Posters 1 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.
  • L Offline
    L Offline
    leppie
    wrote on last edited by
    #1

    I swear there was not a single code review done on any part of that 'thing'. If there was, the code reviewer is a complete idiot. Long story short, was trying to figure how to provide my own 'complex' custom properties in a web part. Easy you say? I thought so too. My first attempt at it was using a TypeConverter applied on the property (yes a plain ol' C# one), but no, that went no where. Then I discovered, a TypeConverter will only be instantiated if applied to the type and not the property. The property being a string, caused me to dish out some silly 'computational object' aka class Category { string Value; }. But alas, that was fruitless as Sharepoint does not bother calling GetStandardValuesSupported even. All I want is bloody dropdownlist with a few values! Then I decided to look at what they invent inside the above-mentioned assembly. WARNING: Do NOT attempt to do the following without your shrink present and/or a fire truck nearby. People have been known to commit suicide and/or spontaneously combust attempting the following. I take no responsibility after this point. I opened up Reflector, and yes, they indeed re-invented the wheel and poorly as hell. All the extensibility stuff is marked internal. And hardcoded mostly. So unless I work for Microsoft, tough cookies. (BTW I did the same thing as an exercise many many years back, why this is above their skill level is beyond me. See xacc.propertygrid[^].) While trying to see what could be done, I came across some bad code, but this one stabbed me in the eye. I will only regain vision in a few weeks the doctor says.

    string name;
    if ((name = obj.Info) != null && name == "Zone") { ... }

    Why on earth could they not just use this:

    if (obj.Info == "Zone") { ... }

    What self-respecting developer would allow such rubbish to pass a code review or even allowed to be written? Did they think they were optimizing the code? Did they even read the manual?

    IronScheme
    ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x)))

    P K L 3 Replies Last reply
    0
    • L leppie

      I swear there was not a single code review done on any part of that 'thing'. If there was, the code reviewer is a complete idiot. Long story short, was trying to figure how to provide my own 'complex' custom properties in a web part. Easy you say? I thought so too. My first attempt at it was using a TypeConverter applied on the property (yes a plain ol' C# one), but no, that went no where. Then I discovered, a TypeConverter will only be instantiated if applied to the type and not the property. The property being a string, caused me to dish out some silly 'computational object' aka class Category { string Value; }. But alas, that was fruitless as Sharepoint does not bother calling GetStandardValuesSupported even. All I want is bloody dropdownlist with a few values! Then I decided to look at what they invent inside the above-mentioned assembly. WARNING: Do NOT attempt to do the following without your shrink present and/or a fire truck nearby. People have been known to commit suicide and/or spontaneously combust attempting the following. I take no responsibility after this point. I opened up Reflector, and yes, they indeed re-invented the wheel and poorly as hell. All the extensibility stuff is marked internal. And hardcoded mostly. So unless I work for Microsoft, tough cookies. (BTW I did the same thing as an exercise many many years back, why this is above their skill level is beyond me. See xacc.propertygrid[^].) While trying to see what could be done, I came across some bad code, but this one stabbed me in the eye. I will only regain vision in a few weeks the doctor says.

      string name;
      if ((name = obj.Info) != null && name == "Zone") { ... }

      Why on earth could they not just use this:

      if (obj.Info == "Zone") { ... }

      What self-respecting developer would allow such rubbish to pass a code review or even allowed to be written? Did they think they were optimizing the code? Did they even read the manual?

      IronScheme
      ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x)))

      P Offline
      P Offline
      PIEBALDconsult
      wrote on last edited by
      #2

      What are you on about? Please take a breath and add some clarification. If you need a hug (and you seem to) then by all means go get one, even a liquid one.

      1 Reply Last reply
      0
      • L leppie

        I swear there was not a single code review done on any part of that 'thing'. If there was, the code reviewer is a complete idiot. Long story short, was trying to figure how to provide my own 'complex' custom properties in a web part. Easy you say? I thought so too. My first attempt at it was using a TypeConverter applied on the property (yes a plain ol' C# one), but no, that went no where. Then I discovered, a TypeConverter will only be instantiated if applied to the type and not the property. The property being a string, caused me to dish out some silly 'computational object' aka class Category { string Value; }. But alas, that was fruitless as Sharepoint does not bother calling GetStandardValuesSupported even. All I want is bloody dropdownlist with a few values! Then I decided to look at what they invent inside the above-mentioned assembly. WARNING: Do NOT attempt to do the following without your shrink present and/or a fire truck nearby. People have been known to commit suicide and/or spontaneously combust attempting the following. I take no responsibility after this point. I opened up Reflector, and yes, they indeed re-invented the wheel and poorly as hell. All the extensibility stuff is marked internal. And hardcoded mostly. So unless I work for Microsoft, tough cookies. (BTW I did the same thing as an exercise many many years back, why this is above their skill level is beyond me. See xacc.propertygrid[^].) While trying to see what could be done, I came across some bad code, but this one stabbed me in the eye. I will only regain vision in a few weeks the doctor says.

        string name;
        if ((name = obj.Info) != null && name == "Zone") { ... }

        Why on earth could they not just use this:

        if (obj.Info == "Zone") { ... }

        What self-respecting developer would allow such rubbish to pass a code review or even allowed to be written? Did they think they were optimizing the code? Did they even read the manual?

        IronScheme
        ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x)))

        K Offline
        K Offline
        Kevin Drzycimski
        wrote on last edited by
        #3

        Sometimes the code does not get correctly "reflected" by the Reflector, perhaps it is just a Compiler Optimization or so.

        L 1 Reply Last reply
        0
        • K Kevin Drzycimski

          Sometimes the code does not get correctly "reflected" by the Reflector, perhaps it is just a Compiler Optimization or so.

          L Offline
          L Offline
          leppie
          wrote on last edited by
          #4

          Kevin Drzycimski wrote:

          Sometimes the code does not get correctly "reflected" by the Reflector, perhaps it is just a Compiler Optimization or so.

          I was actually using ILSpy, which normally does not change the IL to be more readable. The C# compiler will never re-introduce a local, an assignment to that local, and a subsequent null check. If it had some form of CSE, I would expect the former 2, but the null check is completely redundant. On the other hand, the introduced local is also redundant as the value of name in the branch can on be "Zone". ;p It could be that this was written in VB.NET.

          IronScheme
          ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x)))

          1 Reply Last reply
          0
          • L leppie

            I swear there was not a single code review done on any part of that 'thing'. If there was, the code reviewer is a complete idiot. Long story short, was trying to figure how to provide my own 'complex' custom properties in a web part. Easy you say? I thought so too. My first attempt at it was using a TypeConverter applied on the property (yes a plain ol' C# one), but no, that went no where. Then I discovered, a TypeConverter will only be instantiated if applied to the type and not the property. The property being a string, caused me to dish out some silly 'computational object' aka class Category { string Value; }. But alas, that was fruitless as Sharepoint does not bother calling GetStandardValuesSupported even. All I want is bloody dropdownlist with a few values! Then I decided to look at what they invent inside the above-mentioned assembly. WARNING: Do NOT attempt to do the following without your shrink present and/or a fire truck nearby. People have been known to commit suicide and/or spontaneously combust attempting the following. I take no responsibility after this point. I opened up Reflector, and yes, they indeed re-invented the wheel and poorly as hell. All the extensibility stuff is marked internal. And hardcoded mostly. So unless I work for Microsoft, tough cookies. (BTW I did the same thing as an exercise many many years back, why this is above their skill level is beyond me. See xacc.propertygrid[^].) While trying to see what could be done, I came across some bad code, but this one stabbed me in the eye. I will only regain vision in a few weeks the doctor says.

            string name;
            if ((name = obj.Info) != null && name == "Zone") { ... }

            Why on earth could they not just use this:

            if (obj.Info == "Zone") { ... }

            What self-respecting developer would allow such rubbish to pass a code review or even allowed to be written? Did they think they were optimizing the code? Did they even read the manual?

            IronScheme
            ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x)))

            L Offline
            L Offline
            Lost User
            wrote on last edited by
            #5

            ..with the amount of code coming from Microsoft, it's a wonder that this does not happen more often. I find it amusing that people peek inside their assemblies and are pissed if they do not find near-perfect code. We don't expect that from other companies, do we? :)

            Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

            L 1 Reply Last reply
            0
            • L Lost User

              ..with the amount of code coming from Microsoft, it's a wonder that this does not happen more often. I find it amusing that people peek inside their assemblies and are pissed if they do not find near-perfect code. We don't expect that from other companies, do we? :)

              Bastard Programmer from Hell :suss: if you can't read my code, try converting it here[^]

              L Offline
              L Offline
              leppie
              wrote on last edited by
              #6

              They obviously don't realize an 'axe-murderer' is maintaining/using their code ;p

              IronScheme
              ((λ (x) `(,x ',x)) '(λ (x) `(,x ',x)))

              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