Jam*_*xon 3 c# ienumerable casting icollection
鉴于以下情况:
var collection = myEnumerable as ICollection<MyType>;
Run Code Online (Sandbox Code Playgroud)
引擎盖下会发生什么?ICollection有一个伯爵财产.这个演员是否枚举了可枚举的计数或更多涉及的事情?
什么都没发生.如果myEnumerable确实是一个ICollection<MyType> collection包含它.否则它会null.就那么简单.