Home > Net > What is the mode of store configuration more efficient programs with c #
What is the mode of store configuration more efficient programs with c #
Time:11-17
Recently in to write A small program, there is A listview control that winform runtime to add web host for the first time information, network communication types (TCP, udp) IP address, port number, etc., I'd like to have these information stored, in order to start the next time can immediately communication, the question now is don't know in what way is better, Internet information useful ini, XML, config mode, this have several ways to say who is efficient, and what is the difference between, data volume is not large, dozens of data, there is A question is asked, when the program starts next time reading accessories files, which is how to distinguish information which corresponding to the remote host, such as the initial configuration has A, B, C three host information, the next startup, how to distinguish between A corresponding to A host, A great god, please provide the solution, in this thank you very much!
CodePudding user response:
How much is inefficient, you have to give a quantitative indicators,
CodePudding user response:
Software programming is not speaking out of turn "wrong", but will be subject to the test, will be subject to practice the truth at that time, you want to save configuration data to a UI, the premise is that you understand the first lock configuration data form each line each column represents what, otherwise there would be no need to begin to write code, all all of the problems and solve a sequence, to determine whether the energy spent, necessary ever more important technical need to learn, don't the contradiction,
CodePudding user response:
You say can all three, and the file is read, then controls bound data, also just a few seconds, the efficiency
CodePudding user response:
Ini, XML format is like this, it's very good to distinguish the ABC
INI
[A] A1=A1 A2=A2 [B] B1=B1 B2=B2 [C] .
XML
CodePudding user response:
According to the characteristics of computer hardware, usually read/write memory is faster than a hard disk, but put the memory configuration information not reality, on the hard disk is the same, on the network and slower, monitoring equipment for sale
CodePudding user response:
Storing configuration information stored in a static class, when using the class stored in the XML serialization way, read the deserialized to the class
CodePudding user response:
Dozens of data with what is important? Anyway, you said that a few are text, speaking, reading and writing... There is no difference between
CodePudding user response:
XML should be the most efficient (considering), if you don't consider the scalability, cross-platform and other requirements, I think the DataTable is right choice, can be directly serialize into XML, it is easy to deserialize back, used to hold a two-dimensional table data is easy to implement, and easy to understand, ini don't recommend the use of mandarin (Microsoft),
CodePudding user response:
This need not struggle, if you play with.net core,
Here is the requirement that you return a IConfigurationBuilder, that is for our programmers, way of thinking is not like what blog garden those guys like entangled with what vs yyy "XXX," "mine is better than XXX", for our programmers, we don't consider this,
He is a IConfigurationBuilder, as for you is to provide the realization of the ini, provide json, provide yaml, provide the realization of the ado.net, provide the realization of the redis, provide the realization of XML, we actually don't care,
As here I used a json, so what? You told me you want to use yaml, no problem, I only need nuget a yaml implementation, then it is good to modify a word here,
So, you may have about XXX vs yyy?
CodePudding user response:
Programmers do not either/or,
Programmers to do things, neither left nor right, we stood in the middle, depend on abstract
Microsoft to your abstract is currently IConfigurationBuilder interface, who is Provided for implementing this interface, the programmer does not care about, do you want to left we left, the left side is bad, you say we go to the right,