Placeholder RenderTreeBuilder.SetKey() to enable aspnetcore-tooling work

This commit is contained in:
Steve Sanderson 2019-04-26 14:55:54 +01:00
parent 74d9031f12
commit 28d44af91a
2 changed files with 16 additions and 0 deletions

View File

@ -763,6 +763,7 @@ namespace Microsoft.AspNetCore.Components.RenderTree
public void OpenComponent(int sequence, System.Type componentType) { }
public void OpenComponent<TComponent>(int sequence) where TComponent : Microsoft.AspNetCore.Components.IComponent { }
public void OpenElement(int sequence, string elementName) { }
public void SetKey(object value) { }
}
[System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)]
public readonly partial struct RenderTreeDiff

View File

@ -448,6 +448,21 @@ namespace Microsoft.AspNetCore.Components.RenderTree
OpenComponentUnchecked(sequence, componentType);
}
/// <summary>
/// Assigns the specified key value to the current element or component.
/// </summary>
/// <param name="value">The value for the key.</param>
public void SetKey(object value)
{
// This is just a placeholder to enable work in parallel in the
// aspnetcore-tooling repo.
//
// The real implementation will involve multiple overloads, likely:
// SetKey(int value) -- underlying logic
// SetKey<T>(T value) where T: struct -- avoids boxing 'value' before calling .GetHashCode()
// SetKey(object value) -- performs null check before calling .GetHashCode()
}
private void OpenComponentUnchecked(int sequence, Type componentType)
{
_openElementIndices.Push(_entries.Count);