Refactor DeepClone methods to use expression-bodied members.

This commit is contained in:
Thorsten Sommer 2025-05-24 18:11:07 +02:00
parent 59373a0e60
commit fc103ff346
Signed by untrusted user who does not match committer: tsommer
GPG Key ID: 371BBA77A02C0108
3 changed files with 18 additions and 27 deletions

View File

@ -30,15 +30,12 @@ public class ContentBlock
/// </summary> /// </summary>
public bool HideFromUser { get; init; } public bool HideFromUser { get; init; }
public ContentBlock DeepClone() public ContentBlock DeepClone() => new()
{ {
return new() Time = this.Time,
{ ContentType = this.ContentType,
Time = this.Time, Content = this.Content?.DeepClone(),
ContentType = this.ContentType, Role = this.Role,
Content = this.Content?.DeepClone(), HideFromUser = this.HideFromUser,
Role = this.Role, };
HideFromUser = this.HideFromUser,
};
}
} }

View File

@ -34,16 +34,13 @@ public sealed class ContentImage : IContent, IImageSource
} }
/// <inheritdoc /> /// <inheritdoc />
public IContent DeepClone() public IContent DeepClone() => new ContentImage
{ {
return new ContentImage Source = this.Source,
{ InitialRemoteWait = this.InitialRemoteWait,
Source = this.Source, IsStreaming = this.IsStreaming,
InitialRemoteWait = this.InitialRemoteWait, SourceType = this.SourceType,
IsStreaming = this.IsStreaming, };
SourceType = this.SourceType,
};
}
#endregion #endregion

View File

@ -126,15 +126,12 @@ public sealed class ContentText : IContent
} }
/// <inheritdoc /> /// <inheritdoc />
public IContent DeepClone() public IContent DeepClone() => new ContentText
{ {
return new ContentText Text = this.Text,
{ InitialRemoteWait = this.InitialRemoteWait,
Text = this.Text, IsStreaming = this.IsStreaming,
InitialRemoteWait = this.InitialRemoteWait, };
IsStreaming = this.IsStreaming,
};
}
#endregion #endregion