本文整理汇总了C#中System.Runtime.Serialization.SerializationInfo.ToString方法的典型用法代码示例。如果您正苦于以下问题:C# SerializationInfo.ToString方法的具体用法?C# SerializationInfo.ToString怎么用?C# SerializationInfo.ToString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Runtime.Serialization.SerializationInfo
的用法示例。
在下文中一共展示了SerializationInfo.ToString方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MainWindow
public MainWindow() {
int X;
int Y;
CursorInfo ci;
ClientSize = new System.Drawing.Size (max_labels_row * size_of_label, (((num_of_cursors + (max_labels_row - (num_of_cursors % max_labels_row))) * size_of_label) / (max_labels_row * size_of_label)) * size_of_label);
Text = "SWF Cursor Test App";
labels = new Label[num_of_cursors];
ci = new CursorInfo();
for (int i = 0; i < num_of_cursors; i++) {
GetCursor(i, out ci);
labels[i] = new Label();
labels[i].Location = new Point((i * size_of_label) % (max_labels_row * size_of_label), ((i * size_of_label) / (max_labels_row * size_of_label)) * size_of_label);
labels[i].Size = new Size(size_of_label, size_of_label);
labels[i].Text = ci.name;
labels[i].BackColor = Color.FromArgb(i * 9, i * 9, i * 9);
labels[i].ForeColor = Color.Red;
labels[i].Cursor = ci.cursor;
labels[i].Paint += new PaintEventHandler(MainWindow_Paint);
this.Controls.Add(labels[i]);
}
// Get the GetDataObject method
SerializationInfo si;
FormatterConverter fc;
fc = new FormatterConverter();
si = new SerializationInfo(typeof(Cursor), fc);
((ISerializable)ci.cursor).GetObjectData(si, new StreamingContext(StreamingContextStates.All));
Console.WriteLine("Member count: {0}", si.MemberCount);
Console.WriteLine("Members: {0}", si.MemberCount);
SerializationInfoEnumerator e;
e = si.GetEnumerator();
while (e.MoveNext()) {
Console.WriteLine("Member {0}", e.Name);
}
byte [] data = (byte [])si.GetValue ("CursorData", typeof (byte []));
Console.WriteLine("CursorData:");
for (int i = 0; i < data.Length; i++) {
Console.Write("{0:X2}, ", data[i]);
}
Console.WriteLine("");
Console.WriteLine("Result: {0}", si.ToString());
//ci.cursor.I
KeyDown += new KeyEventHandler(MainWindow_KeyDown);
}