本文整理汇总了C#中System.Runtime.Serialization.SerializationInfo.GetEnumerator方法的典型用法代码示例。如果您正苦于以下问题:C# SerializationInfo.GetEnumerator方法的具体用法?C# SerializationInfo.GetEnumerator怎么用?C# SerializationInfo.GetEnumerator使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Runtime.Serialization.SerializationInfo
的用法示例。
在下文中一共展示了SerializationInfo.GetEnumerator方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SoapFault
internal SoapFault(SerializationInfo info, StreamingContext context)
{
SerializationInfoEnumerator siEnum = info.GetEnumerator();
while(siEnum.MoveNext())
{
String name = siEnum.Name;
Object value = siEnum.Value;
SerTrace.Log(this, "SetObjectData enum ",name," value ",value);
if (String.Compare(name, "faultCode", true, CultureInfo.InvariantCulture) == 0)
{
int index = ((String)value).IndexOf(':');
if (index > -1)
faultCode = ((String)value).Substring(++index);
else
faultCode = (String)value;
}
else if (String.Compare(name, "faultString", true, CultureInfo.InvariantCulture) == 0)
faultString = (String)value;
else if (String.Compare(name, "faultActor", true, CultureInfo.InvariantCulture) == 0)
faultActor = (String)value;
else if (String.Compare(name, "detail", true, CultureInfo.InvariantCulture) == 0)
detail = value;
}
}
示例2: ImageListStreamer
private ImageListStreamer(SerializationInfo info, StreamingContext context)
{
SerializationInfoEnumerator enumerator = info.GetEnumerator();
if (enumerator != null)
{
while (enumerator.MoveNext())
{
if (string.Equals(enumerator.Name, "Data", StringComparison.OrdinalIgnoreCase))
{
byte[] input = (byte[]) enumerator.Value;
if (input != null)
{
IntPtr userCookie = System.Windows.Forms.UnsafeNativeMethods.ThemingScope.Activate();
try
{
MemoryStream dataStream = new MemoryStream(this.Decompress(input));
lock (internalSyncObject)
{
SafeNativeMethods.InitCommonControls();
this.nativeImageList = new ImageList.NativeImageList(SafeNativeMethods.ImageList_Read(new System.Windows.Forms.UnsafeNativeMethods.ComStreamFromDataStream(dataStream)));
}
}
finally
{
System.Windows.Forms.UnsafeNativeMethods.ThemingScope.Deactivate(userCookie);
}
if (this.nativeImageList.Handle == IntPtr.Zero)
{
throw new InvalidOperationException(System.Windows.Forms.SR.GetString("ImageListStreamerLoadFailed"));
}
}
}
}
}
}
示例3: TOCList
public TOCList(SerializationInfo info, StreamingContext context)
{
TOCNode[] tocNodes = null;
SerializationInfoEnumerator enumerator = info.GetEnumerator();
while( enumerator.MoveNext())
{
switch( enumerator.Name)
{
case "TOCNodes":
tocNodes = (TOCNode[])info.GetValue("TOCNodes", typeof(TOCNode[]));
break;
}
}
if (tocNodes == null)
throw new SerializationException();
arrayList.Clear();
hashTable.Clear();
for (int i = 0; i < tocNodes.Length; i++)
{
arrayList.Add(tocNodes[i]);
hashTable.Add(tocNodes[i].Identifier, tocNodes[i]);
}
}
示例4: ComObjRef
public ComObjRef(SerializationInfo info, StreamingContext ctx)
{
byte[] b = null;
IntPtr zero = IntPtr.Zero;
SerializationInfoEnumerator enumerator = info.GetEnumerator();
while (enumerator.MoveNext())
{
if (enumerator.Name.Equals("buffer"))
{
b = (byte[]) enumerator.Value;
}
}
try
{
zero = Proxy.UnmarshalObject(b);
this._realobj = Marshal.GetObjectForIUnknown(zero);
}
finally
{
if (zero != IntPtr.Zero)
{
Marshal.Release(zero);
}
}
if (this._realobj == null)
{
throw new NotSupportedException();
}
}
示例5: LogicalCallContext
internal LogicalCallContext(SerializationInfo info, StreamingContext context)
{
SerializationInfoEnumerator enumerator = info.GetEnumerator();
while (enumerator.MoveNext())
{
if (enumerator.Name.Equals("__RemotingData"))
{
this.m_RemotingData = (CallContextRemotingData) enumerator.Value;
}
else
{
if (enumerator.Name.Equals("__SecurityData"))
{
if (context.State == StreamingContextStates.CrossAppDomain)
{
this.m_SecurityData = (CallContextSecurityData) enumerator.Value;
}
continue;
}
if (enumerator.Name.Equals("__HostContext"))
{
this.m_HostContext = enumerator.Value;
continue;
}
if (enumerator.Name.Equals("__CorrelationMgrSlotPresent"))
{
this.m_IsCorrelationMgr = (bool) enumerator.Value;
continue;
}
this.Datastore[enumerator.Name] = enumerator.Value;
}
}
}
示例6: OwnerDrawPropertyBag
protected OwnerDrawPropertyBag(SerializationInfo info, StreamingContext context)
{
this.foreColor = Color.Empty;
this.backColor = Color.Empty;
SerializationInfoEnumerator enumerator = info.GetEnumerator();
while (enumerator.MoveNext())
{
SerializationEntry current = enumerator.Current;
if (current.Name == "Font")
{
this.font = (System.Drawing.Font) current.Value;
}
else
{
if (current.Name == "ForeColor")
{
this.foreColor = (Color) current.Value;
continue;
}
if (current.Name == "BackColor")
{
this.backColor = (Color) current.Value;
}
}
}
}
示例7: ServicedComponentMarshaler
protected ServicedComponentMarshaler(SerializationInfo info, StreamingContext context) : base(info, context)
{
byte[] buffer = null;
Type type = null;
bool flag = false;
ComponentServices.InitializeRemotingChannels();
SerializationInfoEnumerator enumerator = info.GetEnumerator();
while (enumerator.MoveNext())
{
if (enumerator.Name.Equals("servertype"))
{
type = (Type) enumerator.Value;
}
else
{
if (enumerator.Name.Equals("dcomInfo"))
{
buffer = (byte[]) enumerator.Value;
continue;
}
if (enumerator.Name.Equals("fIsMarshalled"))
{
int num = 0;
object obj2 = enumerator.Value;
if (obj2.GetType() == typeof(string))
{
num = ((IConvertible) obj2).ToInt32(null);
}
else
{
num = (int) obj2;
}
if (num == 0)
{
flag = true;
}
}
}
}
if (!flag)
{
this._marshalled = true;
}
this._um = new SCUnMarshaler(type, buffer);
this._rt = type;
if (base.IsFromThisProcess() && !ServicedComponentInfo.IsTypeEventSource(type))
{
this._rp = RemotingServices.GetRealProxy(base.GetRealObject(context));
}
else
{
if (ServicedComponentInfo.IsTypeEventSource(type))
{
this.TypeInfo = new SCMTypeName(type);
}
object realObject = base.GetRealObject(context);
this._rp = RemotingServices.GetRealProxy(realObject);
}
this._um.Dispose();
}
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:60,代码来源:ServicedComponentMarshaler.cs
示例8: BaseSettings
protected BaseSettings(SerializationInfo info, StreamingContext context)
{
SerializationInfoEnumerator infoEnum = info.GetEnumerator();
while (infoEnum.MoveNext())
{
switch (infoEnum.Name)
{
case "Name":
_name = info.GetString("Name");
break;
case "ContentType":
_contentType = (ContentType)info.GetValue("ContentType", typeof(ContentType));
break;
case "Order":
_order = info.GetUInt16("Order");
break;
case "Activated":
_activated = info.GetBoolean("Activated");
break;
}
}
}
示例9: TreeNode
protected TreeNode (SerializationInfo serializationInfo, StreamingContext context) : this ()
{
SerializationInfoEnumerator en;
SerializationEntry e;
int children;
en = serializationInfo.GetEnumerator();
children = 0;
while (en.MoveNext()) {
e = en.Current;
switch(e.Name) {
case "Text": Text = (string)e.Value; break;
case "PropBag": prop_bag = (OwnerDrawPropertyBag)e.Value; break;
case "ImageIndex": image_index = (int)e.Value; break;
case "SelectedImageIndex": selected_image_index = (int)e.Value; break;
case "Tag": tag = e.Value; break;
case "IsChecked": check = (bool)e.Value; break;
case "ChildCount": children = (int)e.Value; break;
}
}
if (children > 0) {
for (int i = 0; i < children; i++) {
TreeNode node = (TreeNode) serializationInfo.GetValue ("children" + i, typeof (TreeNode));
Nodes.Add (node);
}
}
}
示例10: XsltException
protected XsltException(SerializationInfo info, StreamingContext context) : base(info, context)
{
this.res = (string) info.GetValue("res", typeof(string));
this.args = (string[]) info.GetValue("args", typeof(string[]));
this.sourceUri = (string) info.GetValue("sourceUri", typeof(string));
this.lineNumber = (int) info.GetValue("lineNumber", typeof(int));
this.linePosition = (int) info.GetValue("linePosition", typeof(int));
string str = null;
SerializationInfoEnumerator enumerator = info.GetEnumerator();
while (enumerator.MoveNext())
{
SerializationEntry current = enumerator.Current;
if (current.Name == "version")
{
str = (string) current.Value;
}
}
if (str == null)
{
this.message = CreateMessage(this.res, this.args, this.sourceUri, this.lineNumber, this.linePosition);
}
else
{
this.message = null;
}
}
示例11: Serialize
public void Serialize(IAppendingFudgeFieldContainer msg, object obj, Action<object, SerializationInfo, StreamingContext> serializeMethod)
{
var si = new SerializationInfo(type, formatterConverter);
beforeAfterMixin.CallBeforeSerialize(obj);
serializeMethod(obj, si, streamingContext);
beforeAfterMixin.CallAfterSerialize(obj);
// Pull the data out of the SerializationInfo and add to the message
var e = si.GetEnumerator();
while (e.MoveNext())
{
string name = e.Name;
object val = e.Value;
if (val != null)
{
msg.Add(name, val);
}
else
{
// .net binary serialization still outputs the member with a null, so we have to do
// the same (using Indicator), otherwise deserialization blows up.
msg.Add(name, IndicatorType.Instance);
}
}
}
示例12: KTreeView
public KTreeView(SerializationInfo info, StreamingContext context)
: this()
{
Dictionary<string,TreeNode> nodesList = new Dictionary<string,TreeNode>();
SerializationInfoEnumerator infoEnumerator = info.GetEnumerator();
while (infoEnumerator.MoveNext())
{
NodeBase node = info.GetValue(infoEnumerator.Name, infoEnumerator.ObjectType) as NodeBase;
if (node != null)
{
string[] parts=infoEnumerator.Name.Split(new char[]{';'});
string id = parts[0].Split(new char[] { ':' })[1];
string parent = parts[1].Split(new char[] { ':' })[1];
if (string.IsNullOrEmpty(parent))
{
this.Nodes.Add(node);
}
else
{
NodeBase mynode = GetNode(node, parent);
mynode.Nodes.Add(node);
}
}
}
}
示例13: ScriptScopeDictionary
public ScriptScopeDictionary(SerializationInfo info, StreamingContext context)
: base()
{
var e = info.GetEnumerator();
while(e.MoveNext()){
base[e.Name as object] = e.Value;
}
}
示例14: CustomSerializableObject
protected CustomSerializableObject(SerializationInfo info, StreamingContext context)
{
SerializationInfoEnumerator enumerator = info.GetEnumerator();
while (enumerator.MoveNext())
{
FieldInfo fieldInfo = GetType().GetField(enumerator.Name, GetBindingFlags());
object value = info.GetValue(enumerator.Name, typeof(object));
fieldInfo.SetValue(this, value);
}
}
示例15: CacheListOfAttributeValuesWrapper
private CacheListOfAttributeValuesWrapper(SerializationInfo info, StreamingContext context)
{
this.List = new List<AttributeValue>();
var en = info.GetEnumerator();
while (en.MoveNext())
{
this.List.Add(((CacheAttributeValueWrapper)en.Value).AttributeValue);
}
}