Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PropertyNameをキーにした場合にCSV側とクラス側のプロパティ定義数が一致していないとデシリアライズ結果が正しくないものになる #15

Open
xenoPot opened this issue Jan 1, 2025 · 0 comments

Comments

@xenoPot
Copy link

xenoPot commented Jan 1, 2025

次のようなcsvとクラス定義の状態でデシリアライズを行うと、keyAsPropertyName=trueでcsv側項目と名称が一致していても
実際の Key Valuenull となってしまいます。
想定される結果は Key=="FirstMapKey" Value=="DebugRoom" です。

comment,version,Key,Value
,,FirstMapKey,DebugRoom
    [CsvObject(true)]
    [Serializable]
    public partial class HogeData
    {
        public string Key;
        public string Value;
    }

csv側に存在しているcomment version の項目をクラス定義側に追加してデシリアライズした場合は、
追加2項目とKey Valueそれぞれ正しい値が格納されます。

別の例として
下記のセットの場合、デシリアライズ結果は Key=="DebugRoom" Value=="Debug Room" BgColor==null FrameColor==null となってしまうようです。

comment,version,Key,Name,BgColor,FrameColor
,,DebugRoom,Debug Room,52372a,d4ae87
    [CsvObject(true)]
    [Serializable]
    public partial class MapData
    {
        public string Key;
        public string Name;
        public string BgColor;
        public string FrameColor;
    }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant