Skip to content

Commit

Permalink
[C#] fix: Remove [] intializer notation (#2232)
Browse files Browse the repository at this point in the history
## Linked issues

closes: #minor

## Details
remove `[]` notation because it is not supported in version < C#12. That
includes .NET 6 which is a framework we target.

## Attestation Checklist

- [x] My code follows the style guidelines of this project

- I have checked for/fixed spelling, linting, and other errors
- I have commented my code for clarity
- I have made corresponding changes to the documentation (updating the
doc strings in the code is sufficient)
- My changes generate no new warnings
- I have added tests that validates my changes, and provides sufficient
test coverage. I have tested with:
  - Local testing
  - E2E testing in Teams
- New and existing unit tests pass locally with my changes

---------

Signed-off-by: dependabot[bot] <[email protected]>
Co-authored-by: Lily Du <[email protected]>
Co-authored-by: lilydu <[email protected]>
Co-authored-by: Tarek Mahmoud Sayed <[email protected]>
Co-authored-by: Steven Ickman <[email protected]>
Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Co-authored-by: Corina <[email protected]>
Co-authored-by: Yiqing Zhao <[email protected]>
Co-authored-by: Yiqing Zhao <[email protected]>
Co-authored-by: Alex Acebo <[email protected]>
  • Loading branch information
10 people authored Dec 11, 2024
1 parent 5d1cf55 commit 9292bb8
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,6 @@

# CS0618: Type or member is obsolete
dotnet_diagnostic.CS0618.severity = silent

# IDE0028: Simplify collection initialization
dotnet_diagnostic.IDE0028.severity = silent
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@

namespace Microsoft.Teams.AI.AI.Models
{
public class SequenceBuilder<T>
internal class SequenceBuilder<T>
{
private Segment _first;
private Segment _last;
private Segment? _first;
private Segment? _last;

public void Append(ReadOnlyMemory<T> data)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@

namespace Microsoft.Teams.AI.AI.Models
{
public class StreamingChatToolCallsBuilder
internal class StreamingChatToolCallsBuilder
{
private readonly Dictionary<int, string> _indexToToolCallId = [];
private readonly Dictionary<int, string> _indexToFunctionName = [];
private readonly Dictionary<int, SequenceBuilder<byte>> _indexToFunctionArguments = [];
private readonly Dictionary<int, string> _indexToToolCallId = new();
private readonly Dictionary<int, string> _indexToFunctionName = new();
private readonly Dictionary<int, SequenceBuilder<byte>> _indexToFunctionArguments = new();

public void Append(StreamingChatToolCallUpdate toolCallUpdate)
{
Expand Down Expand Up @@ -39,7 +39,7 @@ public void Append(StreamingChatToolCallUpdate toolCallUpdate)

public IReadOnlyList<ChatToolCall> Build()
{
List<ChatToolCall> toolCalls = [];
List<ChatToolCall> toolCalls = new();

foreach (KeyValuePair<int, string> indexToToolCallIdPair in _indexToToolCallId)
{
Expand Down

0 comments on commit 9292bb8

Please sign in to comment.