CodeDom和CollectionInitializers有没有办法用C#CodeDom生成字典初始化器?那些支持吗?我想要:privateIDictionarymap=newDictionary{{"Name","Value"},...};这对于CodeDom构造是不可能的。它们不会针对集合初始值设定项进行更新。LukeH有一篇关于3.5功能和CodeDom主题的优秀博客文章您可以做到,但这可能是有史以来最糟糕的噩梦。这就是我现在正在做的。以上就是C#学习教程分享的全部内容:CodeDom和集合初始化器。如果对你有用,需要进一步了解C#学习教程,希望大家多多关注——varlgoDictionary=newCodeMemberField("Dictionary>_setValue",@"=newDictionary>(){{NetMsg.Bool,(objectId,classId,index,packet)=>Classes[objectId][classId].SetBool[index].Invoke(packet.PullBool())},{NetMsg.Int,(objectId,classId,索引,packet)=>Classes[objectId][classId].SetInt[index].Invoke(packet.PullInt())},{NetMsg.UInt,(objectId,classId,index,packet)=>Classes[objectId][classId].SetUInt[index].Invoke(packet.PullUInt())},{NetMsg.Long,(objectId,classId,index,packet)=>类[objectId][classId].SetLong[index].Invoke(packet.PullLong())},{NetMsg.ULong,(objectId,classId,index,packet)=>类[objectId][classId].SetULong[index].Invoke(packet.PullULong())},{NetMsg.Byte,(objectId,classId,index,packet)=>Classes[objectId][classId].SetByte[index].Invoke(packet.PullByte())},{NetMsg.Short,(objectId,classId,index,packet)=>Classes[objectId][classId].SetShort[index].Invoke(packet.PullShort())},{NetMsg.UShort,(objectId,classId,index,packet)=>类[objectId][classId].SetUShort[index].Invoke(packet.PullUShort())},{NetMsg.Char,(objectId,classId,index,packet)=>Classes[objectId][classId].SetChar[index].Invoke(packet.PullChar())},{NetMsg.Float,(objectId,classId,index,packet)=>Classes[objectId][classId].SetFloat[index].Invoke(packet.PullFloat())},{NetMsg.Double,(objectId,classId,index,packet)=>Classes[objectId][classId].SetDouble[index].Invoke(packet.PullDouble())},{NetMsg.String,(objectId,classId,index,packet)=>Classes[objectId][classId].SetString[index].Invoke(packet.PullString())},}");本文整理自网络,不代表立场,如涉及侵权,请点击右下角联系管理员删除,如需转载请注明出处:
