API usage and build warnings

* Fix build warnings related to switch case fallthrough
* Fix build warnings related to use of deprecated types/members
* Avoid using obsolete collection classes
* Prefer new APIs over old