本文整理汇总了C#中IFormatterConverter类的典型用法代码示例。如果您正苦于以下问题:C# IFormatterConverter类的具体用法?C# IFormatterConverter怎么用?C# IFormatterConverter使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
IFormatterConverter类属于命名空间,在下文中一共展示了IFormatterConverter类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SerializationInfo
public SerializationInfo(Type type, IFormatterConverter converter, bool requireSameTokenInPartialTrust)
#endif
{
if ((object)type == null)
{
throw new ArgumentNullException("type");
}
if (converter == null)
{
throw new ArgumentNullException("converter");
}
Contract.EndContractBlock();
objectType = type;
m_fullTypeName = type.FullName;
m_assemName = type.Module.Assembly.FullName;
m_members = new String[defaultSize];
m_data = new Object[defaultSize];
m_types = new Type[defaultSize];
m_converter = converter;
#if FEATURE_SERIALIZATION
this.requireSameTokenInPartialTrust = requireSameTokenInPartialTrust;
#endif
}
示例2: SerializationInfo
public SerializationInfo(Type type, IFormatterConverter converter)
{
if (null == type)
{
throw new ArgumentNullException("type");
}
if (converter == null)
{
throw new ArgumentNullException("converter");
}
m_fullTypeName = type.FullName;
m_assemName = type.Module.Assembly.FullName;
Debug.Assert(m_fullTypeName != null, "[SerializationInfo.ctor]m_fullTypeName!=null");
Debug.Assert(m_assemName != null, "[SerializationInfo.ctor]m_assemName!=null");
m_members = new String[defaultSize];
m_data = new Object[defaultSize];
m_types = new Type[defaultSize];
m_converter = converter;
m_currMember = 0;
}
示例3: SerializationInfo
public SerializationInfo(Type type, IFormatterConverter converter, bool requireSameTokenInPartialTrust)
{
if ((object)type == null)
{
throw new ArgumentNullException("type");
}
if (converter == null)
{
throw new ArgumentNullException("converter");
}
Contract.EndContractBlock();
objectType = type;
m_fullTypeName = type.FullName;
m_assemName = type.Module.Assembly.FullName;
m_members = new String[defaultSize];
m_data = new Object[defaultSize];
m_types = new Type[defaultSize];
m_nameToIndex = new Dictionary<string, int>();
m_converter = converter;
this.requireSameTokenInPartialTrust = requireSameTokenInPartialTrust;
}
示例4: SerializationInfo
public SerializationInfo (Type type, IFormatterConverter converter)
{
if (type == null)
throw new ArgumentNullException ("type", "Null argument");
if (converter == null)
throw new ArgumentNullException ("converter", "Null argument");
this.converter = converter;
assemblyName = type.Assembly.FullName;
fullTypeName = type.FullName;
}
示例5: SerializationInfo
public SerializationInfo(Type type, IFormatterConverter converter)
{
if(type == null)
{
throw new ArgumentNullException("type");
}
if(converter == null)
{
throw new ArgumentNullException("converter");
}
this.converter = converter;
this.assemblyName = type.Assembly.FullName;
this.fullTypeName = type.FullName;
this.names = new ArrayList();
this.values = new ArrayList();
this.types = new ArrayList();
this.generation = 0;
}
示例6: InitSerialize
// Write constructor
internal void InitSerialize(object obj, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, ObjectWriter objectWriter, SerializationBinder binder)
{
_context = context;
_obj = obj;
_serObjectInfoInit = serObjectInfoInit;
_objectType = obj.GetType();
if (_objectType.IsArray)
{
_isArray = true;
InitNoMembers();
return;
}
InvokeSerializationBinder(binder);
objectWriter.ObjectManager.RegisterObject(obj);
ISurrogateSelector surrogateSelectorTemp;
if (surrogateSelector != null && (_serializationSurrogate = surrogateSelector.GetSurrogate(_objectType, context, out surrogateSelectorTemp)) != null)
{
_si = new SerializationInfo(_objectType, converter);
if (!_objectType.IsPrimitive)
{
_serializationSurrogate.GetObjectData(obj, _si, context);
}
InitSiWrite();
}
else if (obj is ISerializable)
{
if (!_objectType.IsSerializable)
{
throw new SerializationException(SR.Format(SR.Serialization_NonSerType, _objectType.FullName, _objectType.Assembly.FullName));
}
_si = new SerializationInfo(_objectType, converter);
((ISerializable)obj).GetObjectData(_si, context);
InitSiWrite();
CheckTypeForwardedFrom(_cache, _objectType, _binderAssemblyString);
}
else
{
InitMemberInfo();
CheckTypeForwardedFrom(_cache, _objectType, _binderAssemblyString);
}
}
示例7: SerializationInfo
public SerializationInfo(Type type, IFormatterConverter converter, bool requireSameTokenInPartialTrust)
{
if (type == null)
{
throw new ArgumentNullException("type");
}
if (converter == null)
{
throw new ArgumentNullException("converter");
}
this.objectType = type;
this.m_fullTypeName = type.FullName;
this.m_assemName = type.Module.Assembly.FullName;
this.m_members = new string[4];
this.m_data = new object[4];
this.m_types = new Type[4];
this.m_converter = converter;
this.m_currMember = 0;
this.requireSameTokenInPartialTrust = requireSameTokenInPartialTrust;
}
示例8: SerializationInfo
public SerializationInfo(Type type, IFormatterConverter converter)
{
if (type == null)
{
throw new ArgumentNullException(nameof(type));
}
if (converter == null)
{
throw new ArgumentNullException(nameof(converter));
}
_rootType = type;
_rootTypeName = type.FullName;
_rootTypeAssemblyName = type.Module.Assembly.FullName;
_names = new string[DefaultSize];
_values = new object[DefaultSize];
_types = new Type[DefaultSize];
_nameToIndex = new LowLevelListDictionary();
_converter = converter;
}
示例9: SerializationInfo
public SerializationInfo(Type type, IFormatterConverter converter)
{
if ((object)type == null)
{
throw new ArgumentNullException(nameof(type));
}
if (converter == null)
{
throw new ArgumentNullException(nameof(converter));
}
_rootType = type;
_rootTypeName = type.FullName;
_rootTypeAssemblyName = type.GetTypeInfo().Module.Assembly.FullName;
_names = new String[defaultSize];
_values = new object[defaultSize];
_types = new Type[defaultSize];
_nameToIndex = new Dictionary<string, int>();
_converter = converter;
}
示例10: SerializationInfo
public SerializationInfo(Type type, IFormatterConverter converter) {
if ((object)type == null) {
throw new ArgumentNullException("type");
}
if (converter==null) {
throw new ArgumentNullException("converter");
}
Contract.EndContractBlock();
objectType = type;
m_fullTypeName = type.FullName;
m_assemName = type.Module.Assembly.FullName;
m_members = new String[defaultSize];
m_data = new Object[defaultSize];
m_types = new Type[defaultSize];
m_converter = converter;
m_currMember = 0;
}
示例11: Init
[System.Security.SecurityCritical] // auto-generated
internal void Init(Type objectType, String[] memberNames, Type[] memberTypes, ISurrogateSelector surrogateSelector, StreamingContext context, ObjectManager objectManager, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, bool bSimpleAssembly)
{
SerTrace.Log( this,objectInfoId, " Constructor 5 ",objectType);
this.objectType = objectType;
this.objectManager = objectManager;
this.wireMemberNames = memberNames;
this.wireMemberTypes = memberTypes;
this.context = context;
this.serObjectInfoInit = serObjectInfoInit;
this.formatterConverter = converter;
this.bSimpleAssembly = bSimpleAssembly;
if (memberNames != null)
isNamed = true;
if (memberTypes != null)
isTyped = true;
if ((object)objectType != null)
InitReadConstructor(objectType, surrogateSelector, context);
}
示例12: Create
[System.Security.SecurityCritical] // auto-generated
internal static ReadObjectInfo Create(Type objectType, String[] memberNames, Type[] memberTypes, ISurrogateSelector surrogateSelector, StreamingContext context, ObjectManager objectManager, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, bool bSimpleAssembly)
{
ReadObjectInfo soi = GetObjectInfo(serObjectInfoInit);
soi.Init(objectType, memberNames,memberTypes, surrogateSelector, context, objectManager, serObjectInfoInit, converter, bSimpleAssembly);
return soi;
}
示例13: InitSerialize
[System.Security.SecurityCritical] // auto-generated
internal void InitSerialize(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, SerializationBinder binder)
{
SerTrace.Log( this, objectInfoId," Constructor 2 ",objectType);
this.objectType = objectType;
this.context = context;
this.serObjectInfoInit = serObjectInfoInit;
if (objectType.IsArray)
{
InitNoMembers();
return;
}
InvokeSerializationBinder(binder);
ISurrogateSelector surrogateSelectorTemp = null;
if (surrogateSelector!=null)
serializationSurrogate = surrogateSelector.GetSurrogate(objectType, context, out surrogateSelectorTemp);
if (serializationSurrogate != null)
{
// surrogate does not have this problem since user has pass in through the BF's ctor
si = new SerializationInfo(objectType, converter);
cache = new SerObjectInfoCache(objectType);
isSi = true;
}
else if (Object.ReferenceEquals(objectType, Converter.typeofObject))
{
}
else if (Converter.typeofISerializable.IsAssignableFrom(objectType))
{
si = new SerializationInfo(objectType, converter, !FormatterServices.UnsafeTypeForwardersIsEnabled());
cache = new SerObjectInfoCache(objectType);
CheckTypeForwardedFrom(cache, objectType, binderAssemblyString);
isSi = true;
}
if (!isSi)
{
InitMemberInfo();
CheckTypeForwardedFrom(cache, objectType, binderAssemblyString);
}
SerTrace.Log( this,objectInfoId," ", objectType," InitSerialize Exit ",isSi);
}
示例14: Serialize
[System.Security.SecurityCritical] // auto-generated
internal static WriteObjectInfo Serialize(Type objectType, ISurrogateSelector surrogateSelector, StreamingContext context, SerObjectInfoInit serObjectInfoInit, IFormatterConverter converter, SerializationBinder binder)
{
WriteObjectInfo soi = GetObjectInfo(serObjectInfoInit);
soi.InitSerialize(objectType, surrogateSelector, context, serObjectInfoInit, converter, binder);
return soi;
}
示例15: SerializationInfo
/* used by the runtime */
private SerializationInfo (Type type)
{
assemblyName = type.Assembly.FullName;
fullTypeName = type.FullName;
converter = new FormatterConverter ();
objectType = type;
}