I'm relatively new to C # programming (programming in general, actually), but I created an application to manage application pools on a server that uses my team at work. It does everything that should be good enough, but the only problem that I encountered is to save the previously used configurations in the app.config file, so the user does not need to enter them manually each time. Be that as it may, I can save and load from the file superbly (along with all the lines that I need in each group).
The problem is that I want to perform a surface check to see if the name string exists in the group before it is written. An example of the app.config part:
<appSettings>
<add Name="RowName" MachineName="MS-02348" AppSrvName="AppServer" WebSrvName="AppNet"/>
<add Name="RowName2" MachineName="MS-68186" AppSrvName="AppServer2" WebSrvName="AppNet2"/>
</appSettings>
So, what am I doing now to load values, I have a method that extracts the appSettings / add nodes and lists them, and then sets the values to the properties of the object. The reason I do this is because I can have a drop-down list that only shows the name of the object, and then all the rest of the information is available when I call the method on the selected item.
In any case, now I want to make sure that if the name already exists in app.config, I suggest the user to write a different name instead of saving it to the database. Having two child nodes with the same "Name" value will cause chaos in my logic.
foreach , , , , , . childnode , node, , , . , , , , , .
?