public static int SizeIn(this DataType type, FinsMemoryArea memory) { var bytes = type.ByteSize(); var x = 1; switch (memory) { case FinsMemoryArea.DM: { x = 2; break; } } var result = bytes / x; return(result); }