我已将我的项目升级为面向C#7并使用VisualStudio2017RC在我的解决方案中实现模式匹配。这样做之后,引入了一些与使用通用参数进行模式匹配有关的错误。考虑以下代码:publicclassPacket{}publicclassKeepalivePacket:Packet{}publicvoidSend(Tpacket)whereT:Packet{if(packetisKeepalivePacketkeepalive){//Dostuffwithkeepalive}switch(packet){caseKeepalivePacketkeepalivePacket://Dostu
我已将我的项目升级为面向C#7并使用VisualStudio2017RC在我的解决方案中实现模式匹配。这样做之后,引入了一些与使用通用参数进行模式匹配有关的错误。考虑以下代码:publicclassPacket{}publicclassKeepalivePacket:Packet{}publicvoidSend(Tpacket)whereT:Packet{if(packetisKeepalivePacketkeepalive){//Dostuffwithkeepalive}switch(packet){caseKeepalivePacketkeepalivePacket://Dostu