src/System.Management.Automation/engine/hostifaces/HostUtilities.cs
/// <summary>
/// Get suggestion text from suggestion scriptblock with arguments.
/// </summary>
Get suggestion text from suggestion scriptblock with arguments.
Get suggestion text from suggestion scriptblock with arguments .
private static string GetSuggestionText(Object suggestion, object[] suggestionArgs, PSModuleInfo invocationModule)
        {
            if (suggestion is ScriptBlock)
            {
                ScriptBlock suggestionScript = (ScriptBlock)suggestion;
                object result = null;
                try
                {
                    result = invocationModule.Invoke(suggestionScript, suggestionArgs);
                }
                catch (Exception e)
                {
                    CommandProcessorBase.CheckForSevereException(e);
                    return String.Empty;
                }
                return (string)LanguagePrimitives.ConvertTo(result, typeof(string), CultureInfo.CurrentCulture);
            }
            else
            {
                return (string)LanguagePrimitives.ConvertTo(suggestion, typeof(string), CultureInfo.CurrentCulture);
            }
        }
private static string GetSuggestionText ( Object suggestion , object [ ] suggestionArgs , PSModuleInfo invocationModule ) { if ( suggestion is ScriptBlock ) { ScriptBlock suggestionScript = ( ScriptBlock ) suggestion ; object result = null ; try { result = invocationModule . Invoke ( suggestionScript , suggestionArgs ) ; } catch ( Exception e ) { CommandProcessorBase . CheckForSevereException ( e ) ; return String . Empty ; } return ( string ) LanguagePrimitives . ConvertTo ( result , typeof ( string ) , CultureInfo . CurrentCulture ) ; } else { return ( string ) LanguagePrimitives . ConvertTo ( suggestion , typeof ( string ) , CultureInfo . CurrentCulture ) ; } }
Get suggestion text from suggestion scriptblock with arguments.
Get suggestion text from suggestion scriptblock with arguments .
// Catch-all OK. This is a third-party call-out.
suggestion
Object
suggestionArgs
object[]
invocationModule
PSModuleInfo