Add some missing doc comments

\n\nCommit migrated from 238b272238
This commit is contained in:
Ryan Brandenburg 2019-06-27 15:58:43 -07:00
parent 919734cbb2
commit a61d9b6921
9 changed files with 87 additions and 7 deletions

View File

@ -56,6 +56,10 @@ namespace Microsoft.Extensions.Localization
SearchedLocation = searchedLocation; SearchedLocation = searchedLocation;
} }
/// <summary>
/// Implicitly converts the <see cref="LocalizedString"/> to a <see cref="string"/>.
/// </summary>
/// <param name="localizedString">The string to be implicitly converted.</param>
public static implicit operator string(LocalizedString localizedString) public static implicit operator string(LocalizedString localizedString)
{ {
return localizedString?.Value; return localizedString?.Value;

View File

@ -6,6 +6,9 @@ using System.Collections.Generic;
namespace Microsoft.Extensions.Localization namespace Microsoft.Extensions.Localization
{ {
/// <summary>
/// Extension methods for operating on <see cref="IStringLocalizer" />'s.
/// </summary>
public static class StringLocalizerExtensions public static class StringLocalizerExtensions
{ {
/// <summary> /// <summary>

View File

@ -8,6 +8,12 @@ namespace Microsoft.Extensions.Localization
/// </summary> /// </summary>
public class LocalizationOptions public class LocalizationOptions
{ {
/// <summary>
/// Creates a new <see cref="LocalizationOptions" />.
/// </summary>
public LocalizationOptions()
{ }
/// <summary> /// <summary>
/// The relative path under application root where resource files are located. /// The relative path under application root where resource files are located.
/// </summary> /// </summary>

View File

@ -14,6 +14,13 @@ namespace Microsoft.Extensions.Localization
{ {
private readonly ConcurrentDictionary<string, IList<string>> _cache = new ConcurrentDictionary<string, IList<string>>(); private readonly ConcurrentDictionary<string, IList<string>> _cache = new ConcurrentDictionary<string, IList<string>>();
/// <summary>
/// Creates a new <see cref="ResourceNamesCache" />
/// </summary>
public ResourceNamesCache()
{
}
/// <inheritdoc /> /// <inheritdoc />
public IList<string> GetOrAdd(string name, Func<string, IList<string>> valueFactory) public IList<string> GetOrAdd(string name, Func<string, IList<string>> valueFactory)
{ {

View File

@ -8,6 +8,10 @@ using System.Threading;
namespace Microsoft.Extensions.ObjectPool namespace Microsoft.Extensions.ObjectPool
{ {
/// <summary>
/// Default implementation of <see cref="ObjectPool<T>"/>.
/// </summary>
/// <typeparam name="T">The type to pool objects for.</typeparam>
public class DefaultObjectPool<T> : ObjectPool<T> where T : class public class DefaultObjectPool<T> : ObjectPool<T> where T : class
{ {
private protected readonly ObjectWrapper[] _items; private protected readonly ObjectWrapper[] _items;
@ -18,11 +22,20 @@ namespace Microsoft.Extensions.ObjectPool
// This class was introduced in 2.1 to avoid the interface call where possible // This class was introduced in 2.1 to avoid the interface call where possible
private protected readonly PooledObjectPolicy<T> _fastPolicy; private protected readonly PooledObjectPolicy<T> _fastPolicy;
/// <summary>
/// Creates an instance of <see cref="DefaultObjectPool<T>"/>.
/// </summary>
/// <param name="policy">The pooling policy to use.</param>
public DefaultObjectPool(IPooledObjectPolicy<T> policy) public DefaultObjectPool(IPooledObjectPolicy<T> policy)
: this(policy, Environment.ProcessorCount * 2) : this(policy, Environment.ProcessorCount * 2)
{ {
} }
/// <summary>
/// Creates an instance of <see cref="DefaultObjectPool<T>"/>.
/// </summary>
/// <param name="policy">The pooling policy to use.</param>
/// <param name="maximumRetained">The maximum number of objects to retain in the pool.</param>
public DefaultObjectPool(IPooledObjectPolicy<T> policy, int maximumRetained) public DefaultObjectPool(IPooledObjectPolicy<T> policy, int maximumRetained)
{ {
_policy = policy ?? throw new ArgumentNullException(nameof(policy)); _policy = policy ?? throw new ArgumentNullException(nameof(policy));

View File

@ -5,10 +5,17 @@ using System;
namespace Microsoft.Extensions.ObjectPool namespace Microsoft.Extensions.ObjectPool
{ {
/// <summary>
/// A provider of <see cref="DefaultObjectPool<T>"/>'s.
/// </summary>
public class DefaultObjectPoolProvider : ObjectPoolProvider public class DefaultObjectPoolProvider : ObjectPoolProvider
{ {
/// <summary>
/// The maximum number of objects to retain in the pool.
/// </summary>
public int MaximumRetained { get; set; } = Environment.ProcessorCount * 2; public int MaximumRetained { get; set; } = Environment.ProcessorCount * 2;
/// <inheritdoc/>
public override ObjectPool<T> Create<T>(IPooledObjectPolicy<T> policy) public override ObjectPool<T> Create<T>(IPooledObjectPolicy<T> policy)
{ {
if (policy == null) if (policy == null)

View File

@ -3,10 +3,23 @@
namespace Microsoft.Extensions.ObjectPool namespace Microsoft.Extensions.ObjectPool
{ {
/// <summary>
/// Represents a policy for managing pooled objects.
/// </summary>
/// <typeparam name="T">The type of object which is being pooled.</typeparam>
public interface IPooledObjectPolicy<T> public interface IPooledObjectPolicy<T>
{ {
/// <summary>
/// Create a <typeparamref name="T"/>.
/// </summary>
/// <returns>The <typeparamref name="T"/> which was created.</returns>
T Create(); T Create();
/// <summary>
/// Put an object in the pool.
/// </summary>
/// <param name="obj">The object to put in the pool.</param>
/// <returns><code>true</code> if put in the pool.</returns>
bool Return(T obj); bool Return(T obj);
} }
} }

View File

@ -3,15 +3,31 @@
namespace Microsoft.Extensions.ObjectPool namespace Microsoft.Extensions.ObjectPool
{ {
/// <summary>
/// A pool of objects.
/// </summary>
/// <typeparam name="T">The type of objects to pool.</typeparam>
public abstract class ObjectPool<T> where T : class public abstract class ObjectPool<T> where T : class
{ {
/// <summary>
/// Returns an object from the pool.
/// </summary>
/// <returns>An object from the pool.</returns>
public abstract T Get(); public abstract T Get();
/// <summary>
/// Put an object in the pool.
/// </summary>
/// <param name="obj">The object to add to the pool.</param>
public abstract void Return(T obj); public abstract void Return(T obj);
} }
/// <summary>
/// Methods for creating <see cref="ObjectPool<T>"/>'s.
/// </summary>
public static class ObjectPool public static class ObjectPool
{ {
/// <inheritdoc />
public static ObjectPool<T> Create<T>(IPooledObjectPolicy<T> policy = null) where T : class, new() public static ObjectPool<T> Create<T>(IPooledObjectPolicy<T> policy = null) where T : class, new()
{ {
var provider = new DefaultObjectPoolProvider(); var provider = new DefaultObjectPoolProvider();

View File

@ -3,13 +3,24 @@
namespace Microsoft.Extensions.ObjectPool namespace Microsoft.Extensions.ObjectPool
{ {
/// <summary>
/// A provider of <see cref="ObjectPool<T>"/>'s.
/// </summary>
public abstract class ObjectPoolProvider public abstract class ObjectPoolProvider
{ {
/// <summary>
/// Creates an <see cref="ObjectPool"/>.
/// </summary>
/// <typeparam name="T">The type to create a pool for.</typeparam>
public ObjectPool<T> Create<T>() where T : class, new() public ObjectPool<T> Create<T>() where T : class, new()
{ {
return Create<T>(new DefaultPooledObjectPolicy<T>()); return Create<T>(new DefaultPooledObjectPolicy<T>());
} }
/// <summary>
/// Creates an <see cref="ObjectPool"/> with the given <see cref="IPooledObjectPolicy<T>"/>.
/// </summary>
/// <typeparam name="T">The type to create a pool for.</typeparam>
public abstract ObjectPool<T> Create<T>(IPooledObjectPolicy<T> policy) where T : class; public abstract ObjectPool<T> Create<T>(IPooledObjectPolicy<T> policy) where T : class;
} }
} }