Microsoft.Sharepoint.dll
-
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, aTypeConverter
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' akaclass Category { string Value; }
. But alas, that was fruitless as Sharepoint does not bother callingGetStandardValuesSupported
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?
-
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, aTypeConverter
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' akaclass Category { string Value; }
. But alas, that was fruitless as Sharepoint does not bother callingGetStandardValuesSupported
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?
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.
-
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, aTypeConverter
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' akaclass Category { string Value; }
. But alas, that was fruitless as Sharepoint does not bother callingGetStandardValuesSupported
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?
Sometimes the code does not get correctly "reflected" by the Reflector, perhaps it is just a Compiler Optimization or so.
-
Sometimes the code does not get correctly "reflected" by the Reflector, perhaps it is just a Compiler Optimization or so.
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. -
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, aTypeConverter
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' akaclass Category { string Value; }
. But alas, that was fruitless as Sharepoint does not bother callingGetStandardValuesSupported
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?
..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[^]
-
..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[^]
They obviously don't realize an 'axe-murderer' is maintaining/using their code ;p