Dynamically typed languages are becoming increasingly popular for different software development scenarios such as Web engineering, rapid prototyping or the construction of applications that require runtime adaptiveness. In contrast, statically typed languages have undeniable advantages such as early type error detection and more opportunities for compiler optimizations. Since both approaches offer different benefits, hybrid statically and dynamically typed programming languages have emerged, and some statically typed languages have also incorporated dynamic typing capabilities. In this paper, we present the minimal core of StaDyn, a hybrid typing language that performs static type inference of both statically and dynamically typed references. The type information gathered by the compiler is used to generate efficient .NET code, obtaining a significant runtime performance improvement compared with C# 4.0 and Visual Basic 10.