MarioZ / MadMilkman.Ini

MadMilkman.Ini is a .NET component which simplifies processing of INI files.
MIT License
164 stars 31 forks source link

Cannot convert an object of type #38

Open danielcshn opened 3 years ago

danielcshn commented 3 years ago

Use this structure in other projects and I had no problems, now I have the following error:

My config.ini

[Game] GameSelect=DE

My code:

Dim setLang As String Dim ini As New IniFile() ini.Load("config.ini") setLang = ini.Sections("Game").Keys("GameSelect").Value

Last line error:

System.InvalidCastException: 'Cannot convert an object of type' System.Collections.Generic.List1 [MadMilkman.Ini.IniSection]' to type 'System.Collections.Generic.IEnumerable`1 [MadMilkman.Ini.IniItem] '.'

My code works with:

Dim setLang As String Dim ini As New IniFile() ini.Load("config.ini") setLang = ini.Sections(0).Keys(0).Value

VisualStudio 2019 Version 16.11.0 .NET Frameworks 3.5 MadMilkman.Ini 1.0.6

Tests: .NET Frameworks 2.0 > NO .NET Frameworks 3.0 > NO .NET Frameworks 3.5 > NO .NET Frameworks 4 > OK .NET Frameworks 4.5 > OK .NET Frameworks 4.6 > OK .NET Frameworks 4.7 > OK

camprevail commented 6 months ago

I'm running into this now too, the index workaround works for now.