Custom serialization of an object in .NET

前端 未结 5 2101
盖世英雄少女心
盖世英雄少女心 2020-12-09 06:00

I have a requirement to serialize a list of objects to a flat file. The calls will be something like:

class MyObject
{
    public int x;
    public int y;
           


        
5条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2020-12-09 06:46

    There are no special serializers for flat files. Use string formatting and manipulation functions, e.g. String.Format ("{0,10}{1,-20}{2,-40}{3,-100}", x, y, a, b) should produce a line formatted according to your format.

提交回复
热议问题