I apologize if my post came across sharply, but it's accurate. "Most" don't have experience outside of their employer so they've never functioned as a professional consultant thrown into diverse environments on every new project and, therefore, forced to find/learn different methodologies. This isn't saying "Most" don't know how to handle their data within the confines they have setup, it's saying "Most" have never had to look for alternative methods so "Most" have no clue what other options are available that might better serve their purposes.
Based upon the follow up posts here, most of you have no idea what XML is or how easy it is to use. Most of you probably agree with a couple of the comments:
...have little need to share data between applications...
...not all projects require the processing and storage overhead...
...Blanket use of xml for small apps / equally small data sets is akin to being invited to bring a guitar to a BBQ and showing up with a piano....
Unfortunately, none of them are true. There is no overhead, there doesn't need to be sharing between apps, and size of app has nothing to do with whether or not to use Xml. The determining factor is how easily do you want to deal with your data? And, how much code do you want to write?
A lot of questions in this, and other, ngs are people trying to learn the various Autodesk APIs. If you discount those, the majority of the remainder are people trying to tackle problems in a linear fashion - from A to B - and they are getting stuck or hung up on things that if they were using a different approach, their problem would be removed or shifted to something simpler. Lets take this post for example:
- The OP is trying to read in points in a particular order and move forward/backwards within that order.
- Most would approach this by opening the file and reading each line within the file one at a time. If the line holds a single value, they send it to an array or collection; if the line is delimited and holds multiple values, they read the line, split it to an array and then populate a larger array/collection. Saving out the data would be the reverse of reading - reading item by item in the container object, writing to a file as a line (or concatenating into a delimited string then writing). To find an item, they will need to loop each line using a comparer to find the matching value and exit the loop when the value match is found. Moving forward/backward would require storing the current item's position within the container and add/subtract 1 to move.
- Some would follow the above scenario but use a better container object like an arraylist that has a binarysearch option to speed up the find/move functions.
- A few would use XML for the data so they could get all of the data in a useable format with 2 lines of code; saving is 1 line. Once populated, the xmldocument has functions for find, next node, previous node, etc.
- A couple would create a custom object to hold the values then use serialization to open the file and populate their object with all of the data in 4 lines of code; saving the data out is 5 lines of code. Once the data is in their object, now they can wrap the xml methods so other members of their team can use simpler calls such as MyPointList.NextPoint, or MyPointList.FindPoint(4,4,0), etc.
Instead of tackling the problem from A to B, look at it and make it easier. The last 2 options remove the problems around getting/saving the data as well as finding and moving within the data structure. IF the OP doesn't control the creation of the text/csv/ini/? input file, the problem changes focus to getting the input file into xml format. Creating an in-memory converter from original format to xml is easier for most people than dealing with the more complicated data structure that they end up creating with arrays or collections. Using other techniques such as XSLTs or CSSs would make the converter possible with 3 or 4 lines of code.
So working smarter not harder is the way to focus your energies. The best way to do this is by learning as much as possible about what is available in the .NET Framework. If I have time, I'll whip up a quick example for those of you that took umbrage to this so you can have the opportunity to see how simple Xml can be and how much time & energy it can save you.