Click here to Skip to main content
15,915,873 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
GeneralRe: 'Load balancing' CPU cores in multithreaded applications Pin
CDP180218-Apr-11 22:22
CDP180218-Apr-11 22:22 
AnswerRe: 'Load balancing' CPU cores in multithreaded applications Pin
GenJerDan19-Apr-11 4:03
GenJerDan19-Apr-11 4:03 
GeneralRe: 'Load balancing' CPU cores in multithreaded applications Pin
CDP180219-Apr-11 4:07
CDP180219-Apr-11 4:07 
GeneralRe: 'Load balancing' CPU cores in multithreaded applications Pin
GenJerDan19-Apr-11 4:17
GenJerDan19-Apr-11 4:17 
QuestionHow to get F# IDE? Pin
swampwiz14-Apr-11 6:49
swampwiz14-Apr-11 6:49 
AnswerRe: How to get F# IDE? [modified] Pin
DaveyM6914-Apr-11 9:36
professionalDaveyM6914-Apr-11 9:36 
AnswerRe: How to get F# IDE? Pin
Richard MacCutchan14-Apr-11 22:30
mveRichard MacCutchan14-Apr-11 22:30 
QuestionGenerics instead of parameters? Pin
Sander Rossel13-Apr-11 7:55
professionalSander Rossel13-Apr-11 7:55 
I had a discussion at work today.
I made a Class that keeps a Private Dictionary(Of String, List(Of IMyInterface)).
I have exposed some Methods that allow adding to the List(Of IMyInterface). The managing of the Dictionary is handled in my Class.
Now to add or delete an item to or from a list, that belongs to a Key in the Dictionary I have made a Method that can be called like:
VB
' Adding
MyClass.AddToList("Key", New IMyInterfaceClass1) ' This will create a new Key in the Dictionary and a new List.
MyClass.AddToList("Key", New IMyInterfaceClass2) ' This will simply add a new item to the List.
' etc.

' Deleting
MyClass.DeleteFromList("Key", TypeOf(IMyInterfaceClass1)) ' This will delete all instances of this Class from the List.
MyClass.DeleteFromList("Key", TypeOf(IMyInterfaceClass2))
' etc.

Now a co-worker said that a beginning programmer could not understand this(?) and that it should look like:
VB
' Adding
MyClass.AddToList(Of IMyInterfaceClass1)("Key") ' Works same as above, different syntax.
MyClass.AddToList(Of IMyInterfaceClass2)("Key")
' etc.

' Deleting
MyClass.DeleteFromList(Of IMyInterfaceClass1)("Key")
MyClass.DeleteFromList(Of IMyInterfaceClass2)("Key")
' etc.

I can agree with him that his method looks pretty nice, but programming is not about beauty of code (not completely anyway). According to my co-worker my Class should be responsible for the creation of the Type that is given to the Generic Method. I do not think that creating Classes using Reflection is really best practice if you have other options, and I have never seen Microsoft Classes (or any Class) that works like this. On top of that it becomes impossible to add a IMyInterfaceClass that requires parameters in its constructor.

Have I really not understood anything about programming or am I really so good that I am the only one who understands how to pass Classes as a parameter to a Function? Confused | :confused:
It's an OO world.

AnswerRe: Generics instead of parameters? Pin
jschell13-Apr-11 8:39
jschell13-Apr-11 8:39 
GeneralRe: Generics instead of parameters? Pin
Sander Rossel13-Apr-11 11:51
professionalSander Rossel13-Apr-11 11:51 
AnswerRe: Generics instead of parameters? Pin
dasblinkenlight13-Apr-11 11:56
dasblinkenlight13-Apr-11 11:56 
GeneralRe: Generics instead of parameters? Pin
Sander Rossel13-Apr-11 19:50
professionalSander Rossel13-Apr-11 19:50 
GeneralRe: Generics instead of parameters? Pin
dasblinkenlight14-Apr-11 5:40
dasblinkenlight14-Apr-11 5:40 
GeneralRe: Generics instead of parameters? Pin
jschell14-Apr-11 9:09
jschell14-Apr-11 9:09 
AnswerRe: Generics instead of parameters? Pin
MicroVirus14-Apr-11 1:42
MicroVirus14-Apr-11 1:42 
AnswerRe: Generics instead of parameters? Pin
Prasanta_Prince16-Apr-11 4:37
Prasanta_Prince16-Apr-11 4:37 
AnswerRe: Generics instead of parameters? Pin
ToddHileHoffer20-Apr-11 10:47
ToddHileHoffer20-Apr-11 10:47 
GeneralRe: Generics instead of parameters? Pin
Sander Rossel20-Apr-11 10:51
professionalSander Rossel20-Apr-11 10:51 
AnswerRe: Generics instead of parameters? Pin
David Farrow29-Apr-11 5:26
David Farrow29-Apr-11 5:26 
GeneralRe: Generics instead of parameters? Pin
Sander Rossel29-Apr-11 7:45
professionalSander Rossel29-Apr-11 7:45 
GeneralRe: Generics instead of parameters? Pin
David Farrow29-Apr-11 8:20
David Farrow29-Apr-11 8:20 
GeneralRe: Generics instead of parameters? Pin
Sander Rossel29-Apr-11 9:05
professionalSander Rossel29-Apr-11 9:05 
QuestionData security: Encryption? Hashing? Which method? Pin
Gregory Gadow13-Apr-11 4:14
Gregory Gadow13-Apr-11 4:14 
AnswerRe: Data security: Encryption? Hashing? Which method? Pin
Not Active13-Apr-11 5:00
mentorNot Active13-Apr-11 5:00 
AnswerRe: Data security: Encryption? Hashing? Which method? Pin
#realJSOP13-Apr-11 5:03
professional#realJSOP13-Apr-11 5:03 

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.