colculate from c sharp