本文整理汇总了C#中System.Runtime.Serialization.Formatters.Binary.BinaryFormatter.Remove方法的典型用法代码示例。如果您正苦于以下问题:C# BinaryFormatter.Remove方法的具体用法?C# BinaryFormatter.Remove怎么用?C# BinaryFormatter.Remove使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
的用法示例。
在下文中一共展示了BinaryFormatter.Remove方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Delete
public void Delete(bool prompt, FrmMain dialogParent)
{
if (!(prompt && ((dialogParent == null) || (new DlgYesNo(dialogParent, "<LOC>Confirm Delete", "<LOC>Are you sure you want to delete this emote?").ShowDialog() != DialogResult.Yes))))
{
FileStream serializationStream = null;
try
{
string fileName = this.FileName;
if (File.Exists(fileName))
{
serializationStream = File.OpenRead(fileName);
List<Emote> graph = new BinaryFormatter().Deserialize(serializationStream) as List<Emote>;
serializationStream.Close();
if (graph != null)
{
graph.Remove(this);
serializationStream = File.OpenWrite(fileName);
new BinaryFormatter().Serialize(serializationStream, graph);
serializationStream.Close();
serializationStream = null;
}
}
AllEmotes.Remove(this.CharSequence);
OnEmotesChanged();
}
finally
{
if (serializationStream != null)
{
serializationStream.Close();
}
}
}
}