<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Using C# 10 with .NET 4.7 Framework in .NET Forum</title>
    <link>https://forums.autodesk.com/t5/net-forum/using-c-10-with-net-4-7-framework/m-p/13275606#M1083</link>
    <description>&lt;P&gt;Thank you very much for your reply.&lt;BR /&gt;I use Visual Studio 2022 Community, AurtoCAD 2020, .NET 4.7 Framework.&lt;BR /&gt;Could you provide more details on how I should proceed, creating a new project from scratch so that it compiles using C# 10?&lt;/P&gt;</description>
    <pubDate>Wed, 22 Jan 2025 11:34:30 GMT</pubDate>
    <dc:creator>Gepaha</dc:creator>
    <dc:date>2025-01-22T11:34:30Z</dc:date>
    <item>
      <title>Using C# 10 with .NET 4.7 Framework</title>
      <link>https://forums.autodesk.com/t5/net-forum/using-c-10-with-net-4-7-framework/m-p/13273621#M1079</link>
      <description>&lt;P&gt;This question is more directed to &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4476837"&gt;@ActivistInvestor&lt;/a&gt; and of course answer if you want. Anyone else who responds is always welcome and I thank you all very much.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'm trying to use the AcMgdLib library from &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4476837"&gt;@ActivistInvestor&lt;/a&gt; (thanks so much for this and so many other solutions). I followed the instructions at&amp;nbsp;&lt;A href="https://github.com/ActivistInvestor/AcMgdLib" target="_blank" rel="noopener"&gt;https://github.com/ActivistInvestor/AcMgdLib&lt;/A&gt;&amp;nbsp; and when I went to test I received a series of errors. Based on research on the internet, I tried to reduce the number of errors by adding packages using PolySharp, Mirosoft.BCL.HashCode, System.Memory, etc. Some problems have been resolved but there are still errors.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I use Visual Studio 2022, AutoCAD 2020 and .NET 4.7 Framework and added the instructions in the “AcMgdLib.csproj” file:&lt;/P&gt;&lt;LI-CODE lang="general"&gt;&amp;lt;PropertyGroup&amp;gt;
   ...
   &amp;lt;TargetFramework&amp;gt;net4.7&amp;lt;/TargetFramework&amp;gt;
   &amp;lt;LangVersion&amp;gt;10&amp;lt;/LangVersion&amp;gt;
   &amp;lt;ImplicitUsings&amp;gt;disable&amp;lt;/ImplicitUsings&amp;gt;
   &amp;lt;Nullable&amp;gt;disable&amp;lt;/Nullable&amp;gt;
   ...
&amp;lt;/PropertyGroup&amp;gt;&lt;/LI-CODE&gt;&lt;P&gt;&lt;BR /&gt;Reading the text at&amp;nbsp;&lt;A href="https://github.com/ActivistInvestor/AcMgdLib" target="_blank" rel="noopener"&gt;https://github.com/ActivistInvestor/AcMgdLib&lt;/A&gt;&amp;nbsp; it seems that there shouldn't be all these compilation errors and it shouldn't be necessary to use NuGet packages.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Errors resolved with PolySharp:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;The type or namespace name 'CallerArgumentExpressionAttribute' could not be found (are you missing a using directive or an assembly reference?)&lt;/LI&gt;&lt;LI&gt;The type or namespace name 'CallerArgumentExpression' could not be found (are you missing a using directive or an assembly reference?)&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Unresolved errors:&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;Operator '&amp;gt;' cannot be applied to operands of type 'IntPtr' and 'int'&lt;/LI&gt;&lt;LI&gt;The name 'CollectionsMarshal' does not exist in the current context&lt;/LI&gt;&lt;LI&gt;Argument 1: cannot convert from 'char' to 'string'&lt;/LI&gt;&lt;LI&gt;The type or namespace name 'Span&amp;lt;&amp;gt;' could not be found (are you missing a using directive or an assembly reference?)&lt;/LI&gt;&lt;LI&gt;'Span&amp;lt;double&amp;gt;' does not contain a definition for 'Sort' and no accessible extension method 'Sort' accepting a first argument of type 'Span&amp;lt;double&amp;gt;' could be found (are you missing a using directive or an assembly reference?)&lt;/LI&gt;&lt;LI&gt;'nint' does not contain a constructor that takes 1 arguments&lt;/LI&gt;&lt;LI&gt;Operator '&amp;gt;' cannot be applied to operands of type 'IntPtr' and 'int'&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;Before posting here, I invested some time looking for a solution but made no progress. So, If &lt;a href="https://forums.autodesk.com/t5/user/viewprofilepage/user-id/4476837"&gt;@ActivistInvestor&lt;/a&gt; or anyone else can help I would be grateful.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2025 14:06:08 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/using-c-10-with-net-4-7-framework/m-p/13273621#M1079</guid>
      <dc:creator>Gepaha</dc:creator>
      <dc:date>2025-01-21T14:06:08Z</dc:date>
    </item>
    <item>
      <title>Re: Using C# 10 with .NET 4.7 Framework</title>
      <link>https://forums.autodesk.com/t5/net-forum/using-c-10-with-net-4-7-framework/m-p/13274186#M1080</link>
      <description>&lt;P&gt;Sorry, I have a pretty long to-do list with AcMgdLib, that requires adding some #ifdefs to the code to make it buildable with .NET 4.8.&amp;nbsp; There may also be some classes that will not work at all with .NET 4.7, and I've yet to identify those.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For Span&amp;lt;T&amp;gt;, the only solution is to install the &lt;A href="https://www.nuget.org/packages/system.memory/" target="_blank" rel="noopener"&gt;System.Memory package for .NET 4.7&lt;/A&gt;.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For CollectionsMarshal, there is no package for .NET 4.7, so it will require a proxy class with #ifdef's, and that's only for using the AsSpan() method to get a span from a List&amp;lt;T&amp;gt;.&amp;nbsp; Not sure how that can be handled for .NET 4.7 yet, but I will have a look at it ASAP.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I opened the discussions area for this library which you can find &lt;A href="https://github.com/ActivistInvestor/AcMgdLib/discussions/1" target="_blank" rel="noopener"&gt;here&lt;/A&gt;, where you can post issues. I'm a bit busy with other things right now, but will try to get to testing a .NET 4.7 build as soon as I can and resolve whatever issues can be resolved. In the mean time, if you can post compiler output showing files and line numbers of the errors you cited above in &lt;A href="https://github.com/ActivistInvestor/AcMgdLib/discussions/2" target="_blank" rel="noopener"&gt;this discussion&lt;/A&gt;, I will prioritize those issues.&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2025 21:11:02 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/using-c-10-with-net-4-7-framework/m-p/13274186#M1080</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2025-01-21T21:11:02Z</dc:date>
    </item>
    <item>
      <title>Re: Using C# 10 with .NET 4.7 Framework</title>
      <link>https://forums.autodesk.com/t5/net-forum/using-c-10-with-net-4-7-framework/m-p/13274303#M1081</link>
      <description>&lt;P&gt;Thank you very much for the answer.&lt;BR /&gt;As much as possible, I will try to post errors&amp;nbsp;&lt;SPAN&gt;in the repo's&amp;nbsp;&amp;nbsp;&lt;A href="https://github.com/ActivistInvestor/AcMgdLib/discussions/1" target="_blank" rel="noopener"&gt;discussions.&lt;/A&gt;&lt;/SPAN&gt;&lt;/P&gt;</description>
      <pubDate>Tue, 21 Jan 2025 19:17:58 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/using-c-10-with-net-4-7-framework/m-p/13274303#M1081</guid>
      <dc:creator>Gepaha</dc:creator>
      <dc:date>2025-01-21T19:17:58Z</dc:date>
    </item>
    <item>
      <title>Re: Using C# 10 with .NET 4.7 Framework</title>
      <link>https://forums.autodesk.com/t5/net-forum/using-c-10-with-net-4-7-framework/m-p/13274920#M1082</link>
      <description>&lt;P&gt;just use net48 , net48(not net4.8) can work on autocad2013-2024&lt;BR /&gt;You should install the sdk for Microsoft net8 to use the new features on the framework&lt;/P&gt;&lt;P&gt;like this&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="18348401357_0-1737513766806.png" style="width: 600px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1457610i7E4D53DD817BBDBD/image-size/medium?v=v2&amp;amp;px=400" role="button" title="18348401357_0-1737513766806.png" alt="18348401357_0-1737513766806.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2025 02:42:37 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/using-c-10-with-net-4-7-framework/m-p/13274920#M1082</guid>
      <dc:creator>18348401357</dc:creator>
      <dc:date>2025-01-22T02:42:37Z</dc:date>
    </item>
    <item>
      <title>Re: Using C# 10 with .NET 4.7 Framework</title>
      <link>https://forums.autodesk.com/t5/net-forum/using-c-10-with-net-4-7-framework/m-p/13275606#M1083</link>
      <description>&lt;P&gt;Thank you very much for your reply.&lt;BR /&gt;I use Visual Studio 2022 Community, AurtoCAD 2020, .NET 4.7 Framework.&lt;BR /&gt;Could you provide more details on how I should proceed, creating a new project from scratch so that it compiles using C# 10?&lt;/P&gt;</description>
      <pubDate>Wed, 22 Jan 2025 11:34:30 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/using-c-10-with-net-4-7-framework/m-p/13275606#M1083</guid>
      <dc:creator>Gepaha</dc:creator>
      <dc:date>2025-01-22T11:34:30Z</dc:date>
    </item>
    <item>
      <title>Re: Using C# 10 with .NET 4.7 Framework</title>
      <link>https://forums.autodesk.com/t5/net-forum/using-c-10-with-net-4-7-framework/m-p/13277076#M1084</link>
      <description>&lt;P&gt;Does editing the project file and editing the property group as shown in your initial post not work?&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2025 00:11:46 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/using-c-10-with-net-4-7-framework/m-p/13277076#M1084</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2025-01-23T00:11:46Z</dc:date>
    </item>
    <item>
      <title>Re: Using C# 10 with .NET 4.7 Framework</title>
      <link>https://forums.autodesk.com/t5/net-forum/using-c-10-with-net-4-7-framework/m-p/13277867#M1085</link>
      <description>&lt;P&gt;It didn't work for me, it generated several errors.&lt;BR /&gt;I'm using Visual Studio 2022 Community, project file is attached.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="Error List" style="width: 999px;"&gt;&lt;img src="https://forums.autodesk.com/t5/image/serverpage/image-id/1458313i1D08E6EF5F077864/image-size/large?v=v2&amp;amp;px=999" role="button" title="AcMgdLib Error List.JPG" alt="Error List" /&gt;&lt;span class="lia-inline-image-caption" onclick="event.preventDefault();"&gt;Error List&lt;/span&gt;&lt;/span&gt;&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2025 11:48:22 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/using-c-10-with-net-4-7-framework/m-p/13277867#M1085</guid>
      <dc:creator>Gepaha</dc:creator>
      <dc:date>2025-01-23T11:48:22Z</dc:date>
    </item>
    <item>
      <title>Re: Using C# 10 with .NET 4.7 Framework</title>
      <link>https://forums.autodesk.com/t5/net-forum/using-c-10-with-net-4-7-framework/m-p/13277964#M1086</link>
      <description>&lt;P&gt;I thought you were talking about creating a new/empty project using .NET 4.7 and setting the language to C#10.0, without referencing AcMgdLib.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The way to consume AcMgdLib and avoid the language version issue altogether is to build AcMgdLib itself as a class library and reference it into projects where it's used. However, until I can resolve the issues with .NET 4.8 I don't think that's going to work.&lt;/P&gt;</description>
      <pubDate>Thu, 23 Jan 2025 12:31:34 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/using-c-10-with-net-4-7-framework/m-p/13277964#M1086</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2025-01-23T12:31:34Z</dc:date>
    </item>
    <item>
      <title>Re: Using C# 10 with .NET 4.7 Framework</title>
      <link>https://forums.autodesk.com/t5/net-forum/using-c-10-with-net-4-7-framework/m-p/13279401#M1087</link>
      <description>&lt;P&gt;&amp;lt;LangVersion&amp;gt;preview&amp;lt;/LangVersion&amp;gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Fri, 24 Jan 2025 02:33:21 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/using-c-10-with-net-4-7-framework/m-p/13279401#M1087</guid>
      <dc:creator>18348401357</dc:creator>
      <dc:date>2025-01-24T02:33:21Z</dc:date>
    </item>
    <item>
      <title>Re: Using C# 10 with .NET 4.7 Framework</title>
      <link>https://forums.autodesk.com/t5/net-forum/using-c-10-with-net-4-7-framework/m-p/13307786#M1088</link>
      <description>&lt;P&gt;Just an update.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Multi-targeting .net 4.8 and .net 8.0 AcMdgLib is going to involve a major effort, that requires a lot of existing code to be modified using conditional compilation.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Here is a few of hundreds of examples, of what must be done in that ongoing effort. Notice the #if/#else/#endif, which the code base is becoming littered with.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;#if NET8_0_OR_GREATER
   record Box
#else
   class Box
#endif
   {
      public Box(int value = 1) { Value = value; }
      public int Value;

      public static Box operator ++(Box box)
      {
         box.Value++;
         return box;
      }

      public static Box operator --(Box box)
      {
         box.Value--;
         return box;
      }

      public static implicit operator int(Box box)
      {
         return box.Value;
      }
   }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="csharp"&gt;      public bool Equals(Database a, Database b)
      {
         if(a is null)
            return b is null;
         if(b is null)
            return false;
         if(ReferenceEquals(a, b)) 
            return true;
#if NET8_0_OR_GREATER    // e.g., AutoCAD 2025+
         return a.RuntimeId() == b.RuntimeId();         // fixed
#else
         return a.UnmanagedObject == b.UnmanagedObject; // can't be fixed
#endif
      }&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Sat, 08 Feb 2025 18:27:48 GMT</pubDate>
      <guid>https://forums.autodesk.com/t5/net-forum/using-c-10-with-net-4-7-framework/m-p/13307786#M1088</guid>
      <dc:creator>ActivistInvestor</dc:creator>
      <dc:date>2025-02-08T18:27:48Z</dc:date>
    </item>
  </channel>
</rss>

