BinaryFormatter的是否适用于任何COM pression? [英] Does BinaryFormatter apply any compression?
问题描述
在.NET中的<一个href="http://msdn.microsoft.com/en-us/library/system.runtime.serialization.formatters.binary.binaryformatter.aspx"><$c$c>BinaryFormatter$c$c>使用对象图序列化,是任何类型的COM pression应用?
When .NET's BinaryFormatter
is used to serialize an object graph, is any type of compression applied?
我问了我是否应该担心有很多重复的字符串和整数对象图的上下文。
I ask in the context of whether I should worry about the object graph having many repeated strings and integers.
修改 - 慢着,如果字符串被拘留在.NET中,有没有必要担心重复的字符串,正确
Edit - Hold on, if strings are interned in .NET, there's no need to worry about repeated strings, right?
推荐答案
没有,它不提供任何COM pression但你可以COM preSS输出使用的 GZipStream
一>键入
No, it doesn't provide any compression but you can compress the output yourself using the GZipStream
type.
编辑: 迈赫达德有这个技术,他的回答到一个很好的例子<一href="http://stackoverflow.com/questions/964697/how-to-com$p$pss-a-net-object-instance-using-gzip">How对COM preSS .NET对象实例使用gzip 。
Mehrdad has a wonderful example of this technique in his answer to How to compress a .net object instance using gzip.
编辑2:字符串的可以的被拘留,但是,这并不意味着每一个字符串的是的实习。我不会就如何或为何CLR决定实习生字符串,因为这可以从版本改变(并修改)版本的任何假设。
Edit 2: Strings can be interned but that doesn't mean that every string is interned. I wouldn't make any assumptions on how or why the CLR decides to intern strings as this can change (and has changed) from version to version.
这篇关于BinaryFormatter的是否适用于任何COM pression?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!