Structural types
Use structural typing to write code that works
with objects with similar features but no common inheritance and interface
declarations. Define structural types similar to defining interfaces,
by specifying the common properties and method signatures. However, use
the structure keyword,
not the interface keyword.
Structural types are statically weaker than interfaces regarding the amount of enforced type information, but their flexibility supports situations where interfaces are ineffective or impossible. Structural types extend static typing to include a broader set of real world situations but still support concise code that catches common coding problems at compile time.
See also
