Beispiel #1
0
        /// <summary>
        /// Gets exported value or <c>null</c>.
        /// </summary>
        public static T TryGetExport <T>(this CompositionContext context)
        {
            T value;

            context.TryGetExport <T>(out value);
            return(value);
        }
Beispiel #2
0
 T?IExportProvider.GetExportedValueOrDefault <T>([CanBeNull] string?contractName) where T : class
 {
     return(_context.TryGetExport <T>(contractName, out var value) ? value : default);