r/csharp • • Oct 30 '19

Fun Using C# before generics...

Post image
968 Upvotes

148 comments sorted by

View all comments

85

u/[deleted] Oct 30 '19

My memories are just SO MANY COLLECTIONS...one for each type. List<T> is SO much nicer.

32

u/Randolpho Oct 30 '19

Ugh... type safe collections. That's old skool C#, that is.

0

u/[deleted] Oct 30 '19

[deleted]

29

u/xampl9 Oct 30 '19

“Bob doesn’t want to give us his age. Is that going to be a problem?”

Yes. Yes it will.

0

u/[deleted] Oct 30 '19

[deleted]

8

u/xampl9 Oct 30 '19

Next week they discover int.MinValue, and now they have two problems.

3

u/[deleted] Oct 31 '19

So funny because it's true.

17

u/continue_stocking Oct 30 '19

Your memory access would be quite efficient while iterating through those ages though, so there's that.

12

u/DanielMcLaury Oct 31 '19

Great, that'll be helpful when I need to find the total age of all the customers in my database.

2

u/ionoy Oct 31 '19

You never know...

4

u/FrogTrainer Oct 31 '19

Think how fast we can iterate over those primitive arrays without the overhead of clunky Lists on our 16 core 4ghz CPUs. Will save so much time!

→ More replies (2)
→ More replies (10)

4

u/plastikmissile Oct 30 '19

At least they invested in actual data types.

*Flashbacks to code base full of variant variables*.

→ More replies (2)

3

u/Waterstick13 Oct 30 '19

explain whats proper for learners

0

u/[deleted] Oct 30 '19

[deleted]

2

u/RangerPretzel Oct 30 '19

3 back-ticks is for Slack, friend. 4 space indent for code formatting on Reddit... :)

3

u/Koutou Oct 30 '19

Works on the new Reddit ui.

2

u/G_Morgan Oct 31 '19

New Reddit UI is still born though. Old Reddit forever!

→ More replies (1)
→ More replies (3)

4

u/iceph03nix Oct 30 '19

I'm making some assumptions, but I'm guessing the VB programmer was basically creating an array of names, an array of Addresses, and an array of ages, and then just expecting (hoping?) that it would always work out that each persons information would be at the same index in the array, instead of creating a person object with each of those attributes.

3

u/swinny89 Oct 30 '19

I'm taking an intro to programming class at the local community college, and they are using VB as the language to teach programming concepts. They just taught us to use parallel arrays instead of multi dimensional arrays when you are working with arrays of different types.

4

u/[deleted] Oct 30 '19

Uh

→ More replies (4)
→ More replies (1)

2

u/sarcasticbaldguy Oct 31 '19

VB6 had a proper collection object and class support, so... Why?

1

u/Eirenarch Oct 31 '19

I think gamedevs still do this for performance reasons.

5

u/jugalator Oct 30 '19 edited Oct 30 '19

My fav is

System.Collections.Specialized.StringCollection

That namespace is quite a non-generic goodie bag. Full of weird stuff. https://docs.microsoft.com/en-us/dotnet/api/system.collections.specialized?view=netframework-4.8

1

u/FrogTrainer Oct 31 '19

Last year I was lucky enough to update an app I wrote Iin 2005. Was able to replace like thirteen strongly typed Collections with List<T>.