Browse Source

add inline docs to GenerateCustomIdStringAsync method

pull/2169/head
Cenngo 3 years ago
parent
commit
7f244975b0
1 changed files with 11 additions and 2 deletions
  1. +11
    -2
      src/Discord.Net.Interactions/InteractionService.cs

+ 11
- 2
src/Discord.Net.Interactions/InteractionService.cs View File

@@ -910,13 +910,22 @@ namespace Discord.Interactions
/// </summary> /// </summary>
/// <typeparam name="T">Type of the object to be serialized.</typeparam> /// <typeparam name="T">Type of the object to be serialized.</typeparam>
/// <param name="obj">Object to be serialized.</param> /// <param name="obj">Object to be serialized.</param>
/// <param name="services">Services that will be passed on to the TypeReader.</param>
/// <param name="services">Services that will be passed on to the <see cref="TypeReader"/>.</param>
/// <returns> /// <returns>
/// A task representing the conversion process. The task result contains the result of the conversion. /// A task representing the conversion process. The task result contains the result of the conversion.
/// </returns> /// </returns>
public Task<string> SerializeValueAsync<T>(T obj, IServiceProvider services) => public Task<string> SerializeValueAsync<T>(T obj, IServiceProvider services) =>
_typeReaderMap.Get(typeof(T), services).SerializeAsync(obj, services); _typeReaderMap.Get(typeof(T), services).SerializeAsync(obj, services);


/// <summary>
/// Serialize and format multiple objects into a Custom Id string.
/// </summary>
/// <param name="format">A composite format string.</param>
/// <param name="services">>Services that will be passed on to the <see cref="TypeReader"/>s.</param>
/// <param name="args">Objects to be serialized.</param>
/// <returns>
/// A task representing the conversion process. The task result contains the result of the conversion.
/// </returns>
public async Task<string> GenerateCustomIdStringAsync(string format, IServiceProvider services, params object[] args) public async Task<string> GenerateCustomIdStringAsync(string format, IServiceProvider services, params object[] args)
{ {
var serializedValues = new string[args.Length]; var serializedValues = new string[args.Length];
@@ -925,7 +934,7 @@ namespace Discord.Interactions
{ {
var arg = args[i]; var arg = args[i];
var typeReader = _typeReaderMap.Get(arg.GetType(), null); var typeReader = _typeReaderMap.Get(arg.GetType(), null);
var result = await typeReader.SerializeAsync(arg, services);
var result = await typeReader.SerializeAsync(arg, services).ConfigureAwait(false);
serializedValues[i] = result; serializedValues[i] = result;
} }




Loading…
Cancel
Save