mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-11-11 02:27:21 +00:00
Moved all extension methods into extension blocks (#1155)
This commit is contained in:
1 parent
acc7d09fa2
commit
c0a75f39ac
138 files changed
+5884
-4954
No files matched your search
@@ -4,18 +4,21 @@ namespace AIStudio.Tools;
|
||||
|
||||
public static class JsonSerializerOptionsExtensions
|
||||
{
|
||||
/// <summary>
|
||||
/// Makes the options read-only and returns them, so that a static field gets its options in one expression.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Options with contracts of their own, i.e., with a TypeInfoResolver, should never change after they were
|
||||
/// declared: whoever used them before such a change would have read or written with other contracts.
|
||||
/// </remarks>
|
||||
/// <param name="options">The options, with their TypeInfoResolver set.</param>
|
||||
/// <returns>The same options, now read-only.</returns>
|
||||
public static JsonSerializerOptions AsReadOnly(this JsonSerializerOptions options)
|
||||
extension(JsonSerializerOptions options)
|
||||
{
|
||||
options.MakeReadOnly();
|
||||
return options;
|
||||
/// <summary>
|
||||
/// Makes the options read-only and returns them, so that a static field gets its options in one expression.
|
||||
/// </summary>
|
||||
/// <remarks>
|
||||
/// Options with contracts of their own, i.e., with a TypeInfoResolver, should never change after they were
|
||||
/// declared: whoever used them before such a change would have read or written with other contracts.
|
||||
/// </remarks>
|
||||
/// <returns>The same options, now read-only.</returns>
|
||||
public JsonSerializerOptions AsReadOnly()
|
||||
{
|
||||
options.MakeReadOnly();
|
||||
return options;
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user