Can any one help me to convert this delphi code to C#.

class function TShrinkConfig.MyVersion: WORD;
ini: TIniFile;
ini := TIniFile.Create(gsIniFile);
Result := ini.ReadInteger(


if (not ini.ValueExists(SHRINK_INI_VERSIONS_SECTION, IntToStr(version))) then

I searched online that TiniFile corresponds to FileStream in C#.
But i am not able to understand and convert it into C#.

Help would be really appreciated.

A TIniFile doesn't directly correspond to FileStream. It's much more specific and is a class for dealing with INI files, files that are text files and which split information between sections - things in a file between square brackets, a way to group similar things together - and key/value pairs. Under each section will be a number of pairs like




In order to transition that code from Delphi to C# you'd need to either write your own methods for handling INI file data (easy enough to do) or search online as there are hundreds of solutions people have already posted to the same issue.

INI files were for years the de facto place to store application and operating system configuration data as it was easily readable and editable by person and machine. Nowadays developers are more likely to use XML to store such information, but if you poke around in the average Windows directory you'll come across loads of files with an INI extension formatted as above.

Hope this helps.