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>
public bool HideFromUser { get; init; }
public ContentBlock DeepClone()
public ContentBlock DeepClone() => new()
{
return new()
{
Time = this.Time,
ContentType = this.ContentType,
Content = this.Content?.DeepClone(),
Role = this.Role,
HideFromUser = this.HideFromUser,
};
}
Time = this.Time,
ContentType = this.ContentType,
Content = this.Content?.DeepClone(),
Role = this.Role,
HideFromUser = this.HideFromUser,
};
}

View File

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

View File

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