.NET 6 中已變更的參數名稱
某些參數名稱已變更,以在參考與實作組件之間保持一致。 大部分的變更都位於參考組件,但少數變更位於實作組件。
先前的行為
有些參考組件參數名稱與其實作組件中對應的參數不同。 這個現象會在使用具名引數和反映時造成問題。
新的行為
在 .NET 6 中,已更新這些不相符的參數名稱,以跨參考和實作組件保持一致。
下表顯示變更的 API 和參數名稱。 此外,Stream
衍生類型上的某些參數名稱已變更。
變更原因
- 如果參考組件參數名稱已變更,則會將新名稱視為更適當或更容易閱讀,而且中斷會減到最低。
- 如果執行階段參數的名稱已變更為取得跨平台或利用參考組件的一致性,則執行階段實作現在會符合方法的公用 API 和文件。
導入的版本
.NET 6
建議的動作
如果您因參數名稱改變而遭遇編譯器錯誤,請據此更新參數名稱。
如果您使用執行階段反映來檢查方法,並且相依於參數名稱,則請更新程式碼以使用新的參數名稱。
受影響的 API
- Microsoft.VisualBasic.Strings.InStr(Int32, String, String, CompareMethod)
- System.Attribute.GetCustomAttributes(MemberInfo, Type)
- System.Attribute.GetCustomAttributes(MemberInfo, Type, Boolean)
- System.Collections.Generic.SortedList<TKey,TValue>.System.Collections.ICollection.CopyTo(Array, Int32)
- System.IO.StreamWriter.WriteLine(ReadOnlySpan<Char>)
- System.IO.FileStream.BeginRead(Byte[], Int32, Int32, AsyncCallback, Object)
- System.IO.FileStream.BeginWrite(Byte[], Int32, Int32, AsyncCallback, Object)
- System.IO.MemoryStream.Read(Span<Byte>)
- System.IO.MemoryStream.ReadAsync(Memory<Byte>, CancellationToken)
- System.IO.MemoryStream.Write(ReadOnlySpan<Byte>)
- System.IO.MemoryStream.WriteAsync(ReadOnlyMemory<Byte>, CancellationToken)
- System.IO.UnmanagedMemoryStream.Read(Span<Byte>)
- System.IO.UnmanagedMemoryStream.Write(ReadOnlySpan<Byte>)
- System.Numerics.Vector.Narrow
- System.Numerics.Vector.Widen
- System.Security.Cryptography.Pkcs.Rfc3161TimestampRequest.ProcessResponse(ReadOnlyMemory<Byte>, Int32)
- System.Security.Cryptography.Pkcs.Rfc3161TimestampToken.TryDecode(ReadOnlyMemory<Byte>, Rfc3161TimestampToken, Int32)
- System.Security.Cryptography.Pkcs.Rfc3161TimestampTokenInfo.Rfc3161TimestampTokenInfo(Oid, Oid, ReadOnlyMemory<Byte>, ReadOnlyMemory<Byte>, DateTimeOffset, Nullable<Int64>, Boolean, Nullable<ReadOnlyMemory<Byte>>, Nullable<ReadOnlyMemory<Byte>>, X509ExtensionCollection)
- System.Security.Cryptography.Pkcs.Rfc3161TimestampTokenInfo.TryDecode(ReadOnlyMemory<Byte>, Rfc3161TimestampTokenInfo, Int32)
- System.Security.Cryptography.Pkcs.SignerInfo.AddUnsignedAttribute(AsnEncodedData)
- System.Security.Cryptography.Pkcs.SignerInfo.RemoveUnsignedAttribute(AsnEncodedData)
- System.Security.Permissions.PrincipalPermission.Equals(Object)
- System.Security.Policy.UrlMembershipCondition.Equals(Object)
- DBDataPermission(DBDataPermission)
- DBDataPermission(DBDataPermissionAttribute)
- DBDataPermission(PermissionState, Boolean)
- System.Data.Common.DBDataPermission.FromXml(SecurityElement)
- System.Data.Common.DBDataPermission.Union(IPermission)
另請參閱
意見反應
https://aka.ms/ContentUserFeedback。
即將登場:在 2024 年,我們將逐步淘汰 GitHub 問題作為內容的意見反應機制,並將它取代為新的意見反應系統。 如需詳細資訊,請參閱:提交並檢視相關的意見反應