.NET 4.5: XMLSerializer构造函数重载的无法解释的参数(“位置”)

[英]C#, .NET 4.5: Unexplained parameter on XMLSerializer constructor overload (“location”)


Working in C# under .NET 4.5. I have looked through questions here and also performed many Google and MSDN searches, and cannot find any explanation or definition for the "location" parameter of this overload of the XMLSerializer constructor. I don't know if it is a namespace, URI, path, etc. Can anyone tell me what this parameter indicates?

在。net 4.5下使用c#。我在这里查看了问题,并执行了许多谷歌和MSDN搜索,但无法找到XMLSerializer构造函数重载的“位置”参数的任何解释或定义。我不知道它是否是一个名称空间、URI、路径等等。有人能告诉我这个参数表示什么吗?

Thanks.

谢谢。

2 个解决方案

#1


3  

If all else fails, use the source. location is ultimately passed to the constructor of TempFileCollection by XmlSerializerCompilerParameters. If no value is supplied, one is taken from the configuration file (specifically the tempFilesLocation key from the system.xml.serialization section), with which we can confirm its true purpose: it's the location for temporary files generated (and read back) by the XML serializer. It's true that the documentation is particularly obtuse on this point.

如果其他方法都失败了,请使用源代码。位置最终通过XmlSerializerCompilerParameters传递给TempFileCollection的构造函数。如果没有提供任何值,则从配置文件(特别是system.xml中的tempfilesfileslocation键)获取一个。序列化部分),我们可以用它来确认它的真正目的:它是由XML序列化器生成(和读取)临时文件的位置。确实,文档在这一点上特别迟钝。

#2


2  

If you follow through the reference source you end up here.

如果你遵循参考源,你会在这里结束。

It would seem it's the directory that XmlSerializer will put the serializer assembly it generates.

XmlSerializer生成的序列化程序集应该放在这个目录中。

If not specified (which is the case with all other overloads), it uses the TempFilesLocation which can be configured per this related question.

如果没有指定(这是所有其他重载的情况),它将使用TempFilesLocation,该位置可以针对这个相关的问题进行配置。


注意!

本站翻译的文章,版权归属于本站,未经许可禁止转摘,转摘请注明本文地址:http://www.silva-art.net/blog/2016/10/03/c0f0567fee0c6909645c56daea789ea5.html



 
© 2014-2019 ITdaan.com 粤ICP备14056181号