Click here to Skip to main content
15,885,936 members
Home / Discussions / C#
   

C#

 
GeneralRe: WMI Connection to Remote PC with ManegementScope too slow(8-10 seconds). The WMI Query itself is OK (under 1 second) Pin
Mustafa Levrek26-Dec-21 2:36
Mustafa Levrek26-Dec-21 2:36 
GeneralRe: WMI Connection to Remote PC with ManegementScope too slow(8-10 seconds). The WMI Query itself is OK (under 1 second) Pin
Dave Kreskowiak26-Dec-21 4:42
mveDave Kreskowiak26-Dec-21 4:42 
Questionnewbie using a game to learn c# and object-oriented programming Could I make an abstract factory to merge the other factories in a game? Pin
biull smith21-Dec-21 2:23
biull smith21-Dec-21 2:23 
AnswerRe: newbie using a game to learn c# and object-oriented programming Could I make an abstract factory to merge the other factories in a game? Pin
#realJSOP21-Dec-21 2:37
mve#realJSOP21-Dec-21 2:37 
GeneralRe: newbie using a game to learn c# and object-oriented programming Could I make an abstract factory to merge the other factories in a game? Pin
biull smith21-Dec-21 3:04
biull smith21-Dec-21 3:04 
GeneralRe: newbie using a game to learn c# and object-oriented programming Could I make an abstract factory to merge the other factories in a game? Pin
Pete O'Hanlon21-Dec-21 4:06
mvePete O'Hanlon21-Dec-21 4:06 
GeneralRe: newbie using a game to learn c# and object-oriented programming Could I make an abstract factory to merge the other factories in a game? Pin
biull smith21-Dec-21 4:17
biull smith21-Dec-21 4:17 
GeneralRe: newbie using a game to learn c# and object-oriented programming Could I make an abstract factory to merge the other factories in a game? Pin
lmoelleb22-Dec-21 0:34
lmoelleb22-Dec-21 0:34 
When your game is running the data is all in memory of the computer. When your program stops this memory will be cleared. So if you wish to save the game, you need to store the state on disk. As disk files have a sequential list of bytes, we refer to the concept of converting your in memory data to a sequential sequence of data "serialization". Converting it back is "deserialization". XML is one of better known formats you can use to represent your data in a file. Another (probably more popular these days) is JSON - I would stick to one of these until you KNOW that another option is better. If you do not need to keep data after your program close (and maybe in the start you don't) you can simply skip this.

Your example code referring to this as a Factory is - a stretch. A factory is used when you need to create a new object - but you need some code that controls which object is created (so if you want to create a "Weapon" object, the Factory might have logic to figure out if it should create a Sword or a Gun object).

So the most important next step for you, is to stop referring to these as Factories. That will just confuse you (as here, you keep asking factory this, factory that - but you do not need a factory, nor do you have a factory)

In your example the XML is read "manually". What I mean with this, is there is code that look for certain named data in the XML file, and then place that into the memory object. The main advantage of this is: 1) Easy to debug, 2) Easy to deal with multiple formats - if you need to read old saved games for example. The disadvantage is a lot of code that takes time to write and maintain. Garry already provided links for the alternative approach, where you basically let the computer come up with an XML structure that match your data. If you do not want to convert data manually as done in your example, then that is how you would avoid all this code.
GeneralRe: newbie using a game to learn c# and object-oriented programming Could I make an abstract factory to merge the other factories in a game? Pin
biull smith6-Jan-22 10:08
biull smith6-Jan-22 10:08 
AnswerRe: newbie using a game to learn c# and object-oriented programming Could I make an abstract factory to merge the other factories in a game? Pin
Gerry Schmitz21-Dec-21 6:30
mveGerry Schmitz21-Dec-21 6:30 
GeneralRe: newbie using a game to learn c# and object-oriented programming Could I make an abstract factory to merge the other factories in a game? Pin
biull smith21-Dec-21 7:01
biull smith21-Dec-21 7:01 
GeneralRe: newbie using a game to learn c# and object-oriented programming Could I make an abstract factory to merge the other factories in a game? Pin
Gerry Schmitz21-Dec-21 7:22
mveGerry Schmitz21-Dec-21 7:22 
GeneralRe: newbie using a game to learn c# and object-oriented programming Could I make an abstract factory to merge the other factories in a game? Pin
biull smith21-Dec-21 8:29
biull smith21-Dec-21 8:29 
GeneralRe: newbie using a game to learn c# and object-oriented programming Could I make an abstract factory to merge the other factories in a game? Pin
Gerry Schmitz21-Dec-21 10:04
mveGerry Schmitz21-Dec-21 10:04 
QuestionRe: newbie using a game to learn c# and object-oriented programming Could I make an abstract factory to merge the other factories in a game? Pin
biull smith21-Dec-21 13:15
biull smith21-Dec-21 13:15 
AnswerRe: newbie using a game to learn c# and object-oriented programming Could I make an abstract factory to merge the other factories in a game? Pin
Gerry Schmitz21-Dec-21 17:56
mveGerry Schmitz21-Dec-21 17:56 
GeneralRe: newbie using a game to learn c# and object-oriented programming Could I make an abstract factory to merge the other factories in a game? Pin
biull smith6-Jan-22 10:18
biull smith6-Jan-22 10:18 
QuestionTotal Newbie... just installing Visual Studio... Pin
Audio Babble17-Dec-21 6:08
Audio Babble17-Dec-21 6:08 
AnswerRe: Total Newbie... just installing Visual Studio... Pin
OriginalGriff17-Dec-21 6:12
mveOriginalGriff17-Dec-21 6:12 
GeneralRe: Total Newbie... just installing Visual Studio... Pin
Audio Babble17-Dec-21 6:24
Audio Babble17-Dec-21 6:24 
QuestionDisplaying data in a textBox Pin
Luis M. Rojas16-Dec-21 8:50
Luis M. Rojas16-Dec-21 8:50 
AnswerRe: Displaying data in a textBox Pin
trønderen16-Dec-21 9:10
trønderen16-Dec-21 9:10 
AnswerRe: Displaying data in a textBox Pin
OriginalGriff16-Dec-21 9:50
mveOriginalGriff16-Dec-21 9:50 
GeneralRe: Displaying data in a textBox Pin
Eddy Vluggen17-Dec-21 1:14
professionalEddy Vluggen17-Dec-21 1:14 
GeneralRe: Displaying data in a textBox Pin
OriginalGriff17-Dec-21 1:42
mveOriginalGriff17-Dec-21 1:42 

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.