Serialization Assembly. Is it needed or not?

前端 未结 4 1577
梦如初夏
梦如初夏 2020-12-11 01:10

I have a .net 2.0 c# ClickOnce app and it connects to its data via Web Services. I\'ve been told that one way to potentially speed up the application is to generate a seria

4条回答
  •  一生所求
    2020-12-11 01:24

    According to Intellitrace, only the first time you XML-serialize a type, a FileNotFoundException is thrown and then caught. This means CLR expects to load an assembly containing all the XML-Serializers for that specific Assembly and when it's not found, a FileNotFoundException is thrown to signal the XmlSerializer: "Hey! Generate the darn assembly!" and this is what happens during that "Catch" and then the previously not found file exists.

    I've read somewhere that using try-catch for logic is a bad exercise. IDK why Microsoft has used this approach...

提交回复
热议问题