Click here to Skip to main content
15,902,275 members
Home / Discussions / C#
   

C#

 
GeneralRe: Hungarian Algorithm Pin
Gengou16-Nov-13 11:53
professionalGengou16-Nov-13 11:53 
AnswerRe: Hungarian Algorithm Pin
PIEBALDconsult16-Nov-13 13:34
mvePIEBALDconsult16-Nov-13 13:34 
GeneralRe: Hungarian Algorithm Pin
Gengou17-Nov-13 7:44
professionalGengou17-Nov-13 7:44 
AnswerRe: Hungarian Algorithm Pin
OriginalGriff16-Nov-13 21:17
mveOriginalGriff16-Nov-13 21:17 
GeneralRe: Hungarian Algorithm Pin
harold aptroot16-Nov-13 21:42
harold aptroot16-Nov-13 21:42 
GeneralRe: Hungarian Algorithm Pin
Gengou17-Nov-13 7:47
professionalGengou17-Nov-13 7:47 
GeneralRe: Hungarian Algorithm Pin
harold aptroot17-Nov-13 8:20
harold aptroot17-Nov-13 8:20 
QuestionBest way to do this? Pin
SledgeHammer0116-Nov-13 8:02
SledgeHammer0116-Nov-13 8:02 
I have a C# object, something like:

class GUIItem
{
string Name;
string Value;
..
.. some random GUI properties
..
}

have another one that represents a database table:

class SomeDBObject
{
string Name;
string Value;
..
.. some random DB properties
..
}

So what happens is that the GUI builds up the GUIItem objects from an XML resource. However, it only has the Name property. It doesn't have the Value since that is stored in the DB. The concept is that the XML resource tells the GUI how to build the UI and the DB stores the values.

So to load the UI, I need to restore the Value properties from the DB.

So what I need to do is to match up the GUIItem and the SomeDBObject by the Name property and copy SomeDBObject.Value over to GUIItem.Value.

I know I can do this easily with a nested for loop O(n^2). But is there some cooler algorithm?

I think most of the time the KVPs in the database and the UI are going to be in the same order, so I can get by with an O(n)... but its possible a new item might be added to the GUI that is not yet configured in the DB and that would throw things off. Or if an item in the GUI was deleted or re-ordered for some reason.

Something in LINQ perhaps with some kind of join?
AnswerRe: Best way to do this? Pin
Ron Beyer16-Nov-13 9:05
professionalRon Beyer16-Nov-13 9:05 
AnswerRe: Best way to do this? Pin
Mycroft Holmes16-Nov-13 17:10
professionalMycroft Holmes16-Nov-13 17:10 
AnswerRe: Best way to do this? Pin
WuRunZhe17-Nov-13 21:26
WuRunZhe17-Nov-13 21:26 
Questionajax script manager Pin
MichaelCheong8916-Nov-13 1:48
MichaelCheong8916-Nov-13 1:48 
SuggestionRe: ajax script manager Pin
Richard MacCutchan16-Nov-13 3:34
mveRichard MacCutchan16-Nov-13 3:34 
GeneralRe: ajax script manager Pin
MichaelCheong8916-Nov-13 4:04
MichaelCheong8916-Nov-13 4:04 
QuestionRe: ajax script manager Pin
Richard MacCutchan16-Nov-13 4:47
mveRichard MacCutchan16-Nov-13 4:47 
Questionretrieve image from database help Pin
MichaelCheong8916-Nov-13 0:27
MichaelCheong8916-Nov-13 0:27 
AnswerRe: retrieve image from database help Pin
Richard MacCutchan16-Nov-13 0:53
mveRichard MacCutchan16-Nov-13 0:53 
GeneralRe: retrieve image from database help Pin
MichaelCheong8916-Nov-13 0:56
MichaelCheong8916-Nov-13 0:56 
SuggestionRe: retrieve image from database help Pin
Richard MacCutchan16-Nov-13 1:00
mveRichard MacCutchan16-Nov-13 1:00 
GeneralRe: retrieve image from database help Pin
MichaelCheong8916-Nov-13 1:47
MichaelCheong8916-Nov-13 1:47 
QuestionHow to execute c# statment in a string?(Compiling and Running code at runtime) Pin
jojoba201115-Nov-13 23:25
jojoba201115-Nov-13 23:25 
AnswerRe: How to execute c# statment in a string?(Compiling and Running code at runtime) Pin
Eddy Vluggen16-Nov-13 1:09
professionalEddy Vluggen16-Nov-13 1:09 
QuestionRe: How to execute c# statment in a string?(Compiling and Running code at runtime) Pin
jojoba201116-Nov-13 3:12
jojoba201116-Nov-13 3:12 
AnswerRe: How to execute c# statment in a string?(Compiling and Running code at runtime) Pin
Eddy Vluggen16-Nov-13 4:06
professionalEddy Vluggen16-Nov-13 4:06 
GeneralRe: How to execute c# statment in a string?(Compiling and Running code at runtime) Pin
BillWoodruff16-Nov-13 4:14
professionalBillWoodruff16-Nov-13 4:14 

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.