public static int CalculatePropertySize(InputEntity entity, System.Func <Value[], int> valueSizeCalculator) { int size = 0; int propertyCount = entity.PropertyCount(); if (propertyCount > 0) { Value[] values = new Value[propertyCount]; for (int i = 0; i < propertyCount; i++) { values[i] = ValueUtils.asValue(entity.PropertyValue(i)); } size += valueSizeCalculator(values); } return(size); }