Support .Net framework 2.0 (#1062)

This commit is contained in:
Fangjun Kuang
2024-06-28 11:27:19 +08:00
committed by GitHub
parent 598c12c4e5
commit 8c4f576f1b
10 changed files with 90 additions and 79 deletions

View File

@@ -3,7 +3,6 @@
/// Copyright (c) 2024.5 by 东风破
using System;
using System.Collections.Generic;
using System.Linq;
using System.Runtime.InteropServices;
namespace SherpaOnnx
@@ -49,7 +48,15 @@ namespace SherpaOnnx
// The caller should ensure all passed streams are ready for decoding.
public void Decode(IEnumerable<OnlineStream> streams)
{
IntPtr[] ptrs = streams.Select(s => s.Handle).ToArray();
// TargetFramework=net20 does not support System.Linq
// IntPtr[] ptrs = streams.Select(s => s.Handle).ToArray();
List<IntPtr> list = new List<IntPtr>();
foreach (OnlineStream s in streams)
{
list.Add(s.Handle);
}
IntPtr[] ptrs = list.ToArray();
Decode(_handle.Handle, ptrs, ptrs.Length);
}