Creating dynamic variable names in C#

前端 未结 4 1359
北海茫月
北海茫月 2020-12-17 03:25

I am trying to write a simple role playing game in C# to become more familiar with the language.

I have a class that loads data from CSV file, creates an object, and

4条回答
  •  甜味超标
    2020-12-17 04:05

    You need to read up on serialization - instead of holding the files in CSV files, you can store them in a serialized format and load them directly into the wanted type.

    You will only need a couple of methods to serialize and deserialize.

    I suggest reading up on:

    • XmlSerializer
    • BinaryFormatter
    • DataContractSerializer
    • JavaScriptSerializer
    • protobuf.net
    • json.net

    The above links are to different serializers (and I have certainly left some off - anyone in the know, if there is a good serializer that you know, please add) - read through, see their APIs, play around with them and see their on-disk formats and make your decision.

提交回复
热议问题