在Xamarin.Forms中,我们经常会根据各个平台的特性特殊处理一些需求,比如:读取应用的版本号。

在此也以读取应用版本号为例,练习DependencyService用法:

创建IPlatformInfoService接口:

 1 using System;
 2 using System.Collections.Generic;
 3 using System.Text;
 4 
 5 namespace XFPractice.Service
 6 {
 7     public interface IPlatformInfoService
 8     {
 9 
10         /// <summary>
11         /// 获取应用版本
12         /// </summary>
13         /// <returns></returns>
14         string GetAppVersion();
15         
16     }
17 }
View Code

相关文章:

  • 2021-10-08
  • 2021-08-09
  • 2022-12-23
  • 2021-08-09
  • 2021-11-30
  • 2022-12-23
  • 2021-07-14
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-08-29
相关资源
相似解决方案