zoukankan      html  css  js  c++  java
  • 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

    ......
    } }
  • 相关阅读:
    nodeType 节点简介
    Hamming Codes
    Preface Numbering(还没好好看USACO的解答)
    位运算常见应用即ACM题优化实例
    Dynamic Programming(动态规划)
    operator new & new operator
    资料记录
    Ordered Fractions
    Healthy Holsteins
    Sorting A ThreeValued Sequence
  • 原文地址:https://www.cnblogs.com/fmys/p/10207739.html
Copyright © 2011-2022 走看看