dezhidki / Tommy

A single-file TOML reader and writer for C#
MIT License
212 stars 16 forks source link

String value is returned with quotes #6

Closed fatihpense closed 3 years ago

fatihpense commented 4 years ago

Is this intentional? I have to use trim to get the value I expected. ((String)config["my"]["key"]).Trim('"')

Thanks for the minimalist library that gets the job done!

dezhidki commented 4 years ago

Greetings!

This does seem like an unwanted effect. Tommy has implicit casts for the native types, but from the looks of it I left the string cast as a ToString() call which automatically adds the quotes: https://github.com/dezhidki/Tommy/blob/af4b67febc53d8ce56838eb2609ccf3738614f62/Tommy/Tommy.cs#L165

It's a quick fix: simply change value.ToString() in the above snippet to value.AsString.Value.

I'll close this issue once I have pushed the fix to master.

Thanks for pointing it out!

fatihpense commented 4 years ago

Hi Denis, Thank you for the quick fix & the library again!

Regards