Author Topic: Playing with C#8 in Framework 4.8  (Read 5266 times)

0 Members and 1 Guest are viewing this topic.

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2145
  • class keyThumper<T>:ILazy<T>
Re: Playing with C#8 in Framework 4.8
« Reply #15 on: August 09, 2023, 11:35:31 PM »
FWIW :
C# 11 is as far as I've gone.

No Blow-Ups yet . . . but my testing has been pretty simple, so far.
Perhaps take care not to use on production code !!

Using Microsoft Visual Studio Community 2022 (64-bit) - Preview
Version 17.8.0 Preview 1.0

My current .csproj file
The references to NUnit will be removed tonight

Code - XML: [Select]
  1. <Project ToolsVersion="15.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
  2.   <Import Project="..\packages\NUnit.3.13.3\build\NUnit.props" Condition="Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" />
  3.   <Import Project="$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props" Condition="Exists('$(MSBuildExtensionsPath)\$(MSBuildToolsVersion)\Microsoft.Common.props')" />
  4.   <PropertyGroup>
  5.     <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
  6.     <Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
  7.     <ProjectGuid>{BCA3F716-BC8B-4DB0-B38E-6DB783DD0576}</ProjectGuid>
  8.     <OutputType>Library</OutputType>
  9.     <AppDesignerFolder>Properties</AppDesignerFolder>
  10.     <RootNamespace>TestStuff_230711</RootNamespace>
  11.     <AssemblyName>TestStuff_230711</AssemblyName>
  12.     <TargetFrameworkVersion>v4.8.1</TargetFrameworkVersion>
  13.     <FileAlignment>512</FileAlignment>
  14.     <Deterministic>true</Deterministic>
  15.     <TargetFrameworkProfile />
  16.     <NuGetPackageImportStamp>
  17.     </NuGetPackageImportStamp>
  18.   </PropertyGroup>
  19.   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
  20.     <DebugSymbols>true</DebugSymbols>
  21.     <DebugType>full</DebugType>
  22.     <Optimize>false</Optimize>
  23.     <DefineConstants>DEBUG;TRACE</DefineConstants>
  24.     <ErrorReport>prompt</ErrorReport>
  25.     <WarningLevel>4</WarningLevel>
  26.     <StartAction>Program</StartAction>
  27.     <StartProgram>C:\Program Files\Autodesk\AutoCAD 2023\acad.exe</StartProgram>
  28.     <StartArguments>/nologo /b "start.scr"</StartArguments>
  29.  
  30. <!-- revised kdub -->
  31.     <OutputPath>bin\x64\Debug\</OutputPath>
  32.     <PlatformTarget>x64</PlatformTarget>
  33.     <!-- <LangVersion>7.3</LangVersion> -->
  34.     <!-- <LangVersion>8.0</LangVersion> -->
  35.     <LangVersion>11.0</LangVersion>
  36.     <Nullable>enable</Nullable>
  37. <!-- revised kdub -->
  38.  
  39.     <DocumentationFile>bin\x64\Debug\TestStuff_230711.xml</DocumentationFile>
  40.   </PropertyGroup>
  41.   <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
  42.     <DebugType>pdbonly</DebugType>
  43.     <Optimize>true</Optimize>
  44.     <DefineConstants>TRACE</DefineConstants>
  45.     <ErrorReport>prompt</ErrorReport>
  46.     <WarningLevel>4</WarningLevel>
  47.  
  48. <!-- revised kdub -->
  49.     <OutputPath>bin\x64\Release\</OutputPath>
  50.     <PlatformTarget>x64</PlatformTarget>
  51.     <!-- <LangVersion>7.3</LangVersion> -->
  52.     <!-- <LangVersion>8.0</LangVersion> -->
  53.     <LangVersion>11.0</LangVersion>
  54.     <Nullable>enable</Nullable>
  55. <!-- revised kdub -->
  56.  
  57.   </PropertyGroup>
  58.   <ItemGroup>
  59.     <Reference Include="AcCoreMgd">
  60.       <HintPath>..\..\..\..\..\Work\ObjectARX_2023\inc\AcCoreMgd.dll</HintPath>
  61.       <Private>False</Private>
  62.     </Reference>
  63.     <Reference Include="AcDbMgd">
  64.       <HintPath>..\..\..\..\..\Work\ObjectARX_2023\inc\AcDbMgd.dll</HintPath>
  65.       <Private>False</Private>
  66.     </Reference>
  67.     <Reference Include="acdbmgdbrep">
  68.       <HintPath>..\..\..\..\..\Work\ObjectARX_2023\inc\acdbmgdbrep.dll</HintPath>
  69.       <Private>False</Private>
  70.     </Reference>
  71.     <Reference Include="AcMgd">
  72.       <HintPath>..\..\..\..\..\Work\ObjectARX_2023\inc\AcMgd.dll</HintPath>
  73.       <Private>False</Private>
  74.     </Reference>
  75.     <Reference Include="nunit.framework, Version=3.13.3.0, Culture=neutral, PublicKeyToken=2638cd05610744eb, processorArchitecture=MSIL">
  76.       <HintPath>..\packages\NUnit.3.13.3\lib\net45\nunit.framework.dll</HintPath>
  77.     </Reference>
  78.     <Reference Include="System" />
  79.     <Reference Include="System.Core" />
  80.     <Reference Include="System.Xml.Linq" />
  81.     <Reference Include="System.Data.DataSetExtensions" />
  82.     <Reference Include="Microsoft.CSharp" />
  83.     <Reference Include="System.Data" />
  84.     <Reference Include="System.Net.Http" />
  85.     <Reference Include="System.Xml" />
  86.   </ItemGroup>
  87.   <ItemGroup>
  88.     <Compile Include="Initialization.cs" />
  89.     <Compile Include="PathNetCore.cs" />
  90.     <Compile Include="Test_cs08_11.cs" />
  91.     <Compile Include="Properties\AssemblyInfo.cs" />
  92.   </ItemGroup>
  93.   <ItemGroup>
  94.     <None Include="packages.config" />
  95.     <None Include="start.scr">
  96.       <CopyToOutputDirectory>Always</CopyToOutputDirectory>
  97.     </None>
  98.   </ItemGroup>
  99.   <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
  100.   <Target Name="EnsureNuGetPackageBuildImports" BeforeTargets="PrepareForBuild">
  101.     <PropertyGroup>
  102.       <ErrorText>This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them.  For more information, see http://go.microsoft.com/fwlink/?LinkID=322105. The missing file is {0}.</ErrorText>
  103.     </PropertyGroup>
  104.     <Error Condition="!Exists('..\packages\NUnit.3.13.3\build\NUnit.props')" Text="$([System.String]::Format('$(ErrorText)', '..\packages\NUnit.3.13.3\build\NUnit.props'))" />
  105.   </Target>
  106. </Project>
  107.  
  108.  
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.

kdub_nz

  • Mesozoic keyThumper
  • SuperMod
  • Water Moccasin
  • Posts: 2145
  • class keyThumper<T>:ILazy<T>
Re: Playing with C#8 in Framework 4.8
« Reply #16 on: August 10, 2023, 07:43:33 PM »
Testing concepts in LinqPad for language changes.

Beginning with C# 11, the interpolated expressions can include newlines.
The text between the { and } must be valid C#, therefore it can include newlines that improve readability.

example of a switch statement in an Interpolated string . . eminently readable !

Of course, the return value of the switch statement could be passed to a layer-changing statement.

« Last Edit: August 10, 2023, 07:46:42 PM by kdub_nz »
Called Kerry in my other life
Retired; but they dragged me back in !

I live at UTC + 13.00

---
some people complain about loading the dishwasher.
Sometimes the question is more important than the answer.