File: System\Runtime\Serialization\KnownTypeAttribute.cs
Web Access
Project: src\src\libraries\System.Runtime.Serialization.Primitives\src\System.Runtime.Serialization.Primitives.csproj (System.Runtime.Serialization.Primitives)
// Licensed to the .NET Foundation under one or more agreements.
// The .NET Foundation licenses this file to you under the MIT license.
 
namespace System.Runtime.Serialization
{
    [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct, Inherited = true, AllowMultiple = true)]
    public sealed class KnownTypeAttribute : Attribute
    {
        public KnownTypeAttribute(Type type)
        {
            Type = type;
        }
 
        public KnownTypeAttribute(string methodName)
        {
            MethodName = methodName;
        }
 
        public string? MethodName { get; }
 
        public Type? Type { get; }
    }
}