Just use var. The analyzer should figure out the right class because of the as statement.