• Develping Libraries With Cross Platform Tools跨平台工具开发库


    设定多个目标版本 How to Multitarge

    <Project Sdk="Microsoft.NET.Sdk">
      <PropertyGroup>
        <TargetFrameworks>netstandard1.4;net40;net45</TargetFrameworks>
      </PropertyGroup>
    
      <!-- Need to conditionally bring in references for the .NET Framework 4.0 target -->
      <ItemGroup Condition="'$(TargetFramework)' == 'net40'">
        <Reference Include="System.Net" />
      </ItemGroup>
    
      <!-- Need to conditionally bring in references for the .NET Framework 4.5 target -->
      <ItemGroup Condition="'$(TargetFramework)' == 'net45'">
        <Reference Include="System.Net.Http" />
        <Reference Include="System.Threading.Tasks" />
      </ItemGroup>
    </Projecusing System;
    using System.Text.RegularExpressions;
    #if NET40
    // This only compiles for the .NET Framework 4 targets
    using System.Net;
    #else
     // This compiles for all other targets
    using System.Net.Http;
    using System.Threading.Tasks;
    #endif
    
    namespace MultitargetLib
    {
        public class Library
        {
    #if NET40
            private readonly WebClient _client = new WebClient();
            private readonly object _locker = new object();
    #else
            private readonly HttpClient _client = new HttpClient();
    #endif

    ......
    } }
  • 相关阅读:
    window.open跨页面传输
    history对象
    类vr特效的360度全景
    移动端图片滑动
    图片拼图
    20180808 考试记录
    [jzoj 5770]【2018提高组模拟A组8.6】可爱精灵宝贝 (区间dp)
    20180806 考试记录
    [luogu2319 HNOI2006] 超级英雄 (匈牙利算法)
    [luogu2679] 子串 (多维dp)
  • 原文地址:https://www.cnblogs.com/fmys/p/10207739.html
Copyright © 2020-2023  润新知