Click here to Skip to main content
15,885,216 members

Welcome to the Lounge

   

For discussing anything related to a software developer's life but is not for programming questions. Got a programming question?

The Lounge is rated Safe For Work. If you're about to post something inappropriate for a shared office environment, then don't post it. No ads, no abuse, and no programming questions. Trolling, (political, climate, religious or whatever) will result in your account being removed.

 
GeneralRe: Does anyone here have an idea of how popular mongoDB is? Pin
Sander Rossel6-May-20 1:24
professionalSander Rossel6-May-20 1:24 
GeneralRe: Does anyone here have an idea of how popular mongoDB is? Pin
Stuart Dootson6-May-20 4:58
professionalStuart Dootson6-May-20 4:58 
AnswerRe: Does anyone here have an idea of how popular mongoDB is? Pin
RickZeeland5-May-20 23:47
mveRickZeeland5-May-20 23:47 
AnswerRe: Does anyone here have an idea of how popular mongoDB is? Pin
Richard MacCutchan6-May-20 0:00
mveRichard MacCutchan6-May-20 0:00 
AnswerRe: Does anyone here have an idea of how popular mongoDB is? Pin
F-ES Sitecore6-May-20 0:46
professionalF-ES Sitecore6-May-20 0:46 
GeneralRe: Does anyone here have an idea of how popular mongoDB is? Pin
honey the codewitch6-May-20 4:08
mvahoney the codewitch6-May-20 4:08 
AnswerRe: Does anyone here have an idea of how popular mongoDB is? Pin
MadMyche6-May-20 8:29
professionalMadMyche6-May-20 8:29 
Rant.NET 1.x Is Why We Can't Have Nice Things Reason #32 Pin
honey the codewitch5-May-20 7:25
mvahoney the codewitch5-May-20 7:25 
Because 1.x existed prior to generics we have issues of legacy object models not implementing IList<T> and instead simply exposing hard typed indexer properties.

Normally, you'd just get the generic parameters of the generic IEnumerable<T> interface, but because some object trees were created prior to 2.0 - like the CodeDOM they don't have them.

This makes determining the element type of a typed list extremely difficult. The problem is that your alternative is the indexer property which isn't a member of a hard interface, so you have to select the appropriate indexer property from the properties on that type. There might be this[string name] in there too, for example. There is no contract however, so there are no guarantees. This isn't especially robust.

Which means, the obvious solution is to first try to get it using the generic interfaces, and if they aren't available, then we fall back to the less robust method above.

This is not ideal, and it requires maybe a page of code to handle all the scenarios.

Microsoft didn't put generics into 1.x I think because of time constraints, and if so they should have waited, IMO.

Edit: For anyone interested I just posted a tip that solves this problem. How To Get A Collection Element Type Using Reflection in C#[^]
Real programmers use butterflies


modified 5-May-20 15:08pm.

GeneralRe: .NET 1.x Is Why We Can't Have Nice Things Reason #32 PinPopular
PIEBALDconsult5-May-20 7:57
mvePIEBALDconsult5-May-20 7:57 
GeneralRe: .NET 1.x Is Why We Can't Have Nice Things Reason #32 Pin
honey the codewitch5-May-20 8:15
mvahoney the codewitch5-May-20 8:15 
JokeRe: .NET 1.x Is Why We Can't Have Nice Things Reason #32 Pin
Greg Utas5-May-20 10:10
professionalGreg Utas5-May-20 10:10 
GeneralRe: .NET 1.x Is Why We Can't Have Nice Things Reason #32 Pin
PIEBALDconsult5-May-20 10:24
mvePIEBALDconsult5-May-20 10:24 
GeneralRe: .NET 1.x Is Why We Can't Have Nice Things Reason #32 Pin
Sander Rossel5-May-20 23:07
professionalSander Rossel5-May-20 23:07 
GeneralRe: .NET 1.x Is Why We Can't Have Nice Things Reason #32 Pin
Richard Deeming6-May-20 0:50
mveRichard Deeming6-May-20 0:50 
GeneralRe: .NET 1.x Is Why We Can't Have Nice Things Reason #32 Pin
PIEBALDconsult6-May-20 3:38
mvePIEBALDconsult6-May-20 3:38 
GeneralRe: .NET 1.x Is Why We Can't Have Nice Things Reason #32 Pin
F-ES Sitecore6-May-20 1:04
professionalF-ES Sitecore6-May-20 1:04 
GeneralRe: .NET 1.x Is Why We Can't Have Nice Things Reason #32 Pin
Dan Neely6-May-20 2:25
Dan Neely6-May-20 2:25 
GeneralRe: .NET 1.x Is Why We Can't Have Nice Things Reason #32 Pin
Mehdi Gholam5-May-20 8:05
Mehdi Gholam5-May-20 8:05 
GeneralRe: .NET 1.x Is Why We Can't Have Nice Things Reason #32 Pin
honey the codewitch5-May-20 8:14
mvahoney the codewitch5-May-20 8:14 
GeneralRe: .NET 1.x Is Why We Can't Have Nice Things Reason #32 Pin
Mehdi Gholam5-May-20 8:30
Mehdi Gholam5-May-20 8:30 
GeneralRe: .NET 1.x Is Why We Can't Have Nice Things Reason #32 Pin
honey the codewitch5-May-20 8:36
mvahoney the codewitch5-May-20 8:36 
GeneralRe: .NET 1.x Is Why We Can't Have Nice Things Reason #32 Pin
PIEBALDconsult5-May-20 8:19
mvePIEBALDconsult5-May-20 8:19 
GeneralRe: .NET 1.x Is Why We Can't Have Nice Things Reason #32 Pin
Greg Utas5-May-20 10:12
professionalGreg Utas5-May-20 10:12 
GeneralRe: .NET 1.x Is Why We Can't Have Nice Things Reason #32 Pin
markrlondon6-May-20 13:21
markrlondon6-May-20 13:21 
GeneralRe: .NET 1.x Is Why We Can't Have Nice Things Reason #32 Pin
Dan Neely6-May-20 2:28
Dan Neely6-May-20 2:28 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.