当前位置: 首页>>代码示例>>C#>>正文


C# FileStream.Deserialize方法代码示例

本文整理汇总了C#中System.IO.FileStream.Deserialize方法的典型用法代码示例。如果您正苦于以下问题:C# FileStream.Deserialize方法的具体用法?C# FileStream.Deserialize怎么用?C# FileStream.Deserialize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.IO.FileStream的用法示例。


在下文中一共展示了FileStream.Deserialize方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Read

    /// <summary>
    /// Reads the collection.
    /// </summary>
    /// <returns>The collection with data that was written.</returns>
    public MainModel Read()
    {
      MainModel result;

      string path = Path.Combine(this.dataDirectory, entitiesNameV1 + ".xml");

      if (!File.Exists(path))
      {
          return null;
      }

      using (FileStream stream = new FileStream(path, FileMode.Open, FileAccess.Read))
      {
        result = stream.Deserialize<MainModel>();
      }

      return result;
    }
开发者ID:ppnrao,项目名称:pickles,代码行数:22,代码来源:MainModelSerializer.cs

示例2: PlManagerHistory

        /// <summary>
        /// Creates a new PlanetLab manager history instance for the specified folder.
        /// </summary>
        /// <param name="slice">The PlanetLab slice.</param>
        public PlManagerHistory(PlSlice slice)
        {
            // Validate the arguments.
            if (null == slice) throw new ArgumentNullException("slice");

            try
            {
                // If the file exists.
                if (File.Exists(CrawlerConfig.Static.PlanetLabHistoryFileName))
                {
                    // Load from file the list of runs.
                    using (FileStream file = new FileStream(CrawlerConfig.Static.PlanetLabHistoryFileName, FileMode.Open))
                    {
                        file.Deserialize<PlManagerHistory>(this);
                    }
                }
            }
            catch
            {
                // Catch all exceptions.
            }
        }
开发者ID:alexbikfalvi,项目名称:InetAnalytics,代码行数:26,代码来源:PlManagerHistory.cs

示例3: GetOnTheFlyGestureDefinition

        public static List<GestureToken> GetOnTheFlyGestureDefinition(Assembly assembly, string resourceName)
        {
            Stream stream = new FileStream(resourceName, FileMode.Open, FileAccess.Read);
                if (stream != null)
                    return stream.Deserialize();
                else

                    return null;
        }
开发者ID:tuliosouza,项目名称:ASG,代码行数:9,代码来源:ContentHelper.cs

示例4: Open

 /// <summary>
 /// Opens the history run with the specified identifier.
 /// </summary>
 /// <param name="id">The history identifier.</param>
 /// <returns>The manager history run.</returns>
 public PlManagerHistoryRun Open(PlManagerHistoryId id)
 {
     // Open the history from the file.
     using (FileStream file = new FileStream(id.FileName, FileMode.Open))
     {
         // Deserialize the history run.
         return file.Deserialize<PlManagerHistoryRun>();
     }
 }
开发者ID:alexbikfalvi,项目名称:InetAnalytics,代码行数:14,代码来源:PlManagerHistory.cs


注:本文中的System.IO.FileStream.Deserialize方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。