Rollup field calculation is done by an async CRM Workflow , however in many scenario you may want to perform run time calculation , the following code illustrate how to invoke the calculation prgroamtically.