I would like to call function attribute (and also type) by it's name.
In python this goes something like this:
import time
method_to_call = getattr(time, 'clock') # time.clock()
result = method_to_call()
print(result)
But what about C# and types?
I want to use sizeof
on converted ITEM_STRING_TO_TYPE
. Is it even possible in C#?
List<string> mainList = new List<string>(new string[]
{
"bool",
"byte",
"char",
"decimal",
"double",
"float",
"int",
"long",
"sbyte",
"short",
"uint",
"ulong",
"ushort"
});
foreach (string item in mainList)
{
Console.WriteLine("Size of {0} : {1}", item, sizeof(ITEM_STRING_TO_TYPE));
// like this
Console.WriteLine("Size of int: {0}", sizeof(int));
}