This is a very simple piece of code which makes use of the java.util.Properties class and load the properties file using java.io.File and it’s associated InputStream class.Here the properties are accessed as a map of name/value pairs. This code can be tweaked bit using the ConfigSlurper class and the values can be accessed as object properties as shown below:

We can write a similar ConfigSlurper in C# using the System.Dynamic.ExpandoObject which allows us to add and remove properties to this object at runtime.ExpandoObject implement a IDictionary and IDynamicMetaObjectProvider interfaces as shown in the definition below: