refactor add-type c# code