示例#1
0
    /// <summary>
    /// Helper method to call <see cref="CILAssemblyLoader.TryGetResourceFor"/> method
    /// </summary>
    /// <param name="loader">The <see cref="CILAssemblyLoader"/>.</param>
    /// <param name="module">The <see cref="CILModule"/>.</param>
    /// <returns>The out parameter of <see cref="CILAssemblyLoader.TryGetResourceFor"/>.</returns>
    /// <exception cref="ArgumentException">If <see cref="CILAssemblyLoader.TryGetResourceFor"/> returns <c>false</c>.</exception>
    public static String GetResourceFor(this CILAssemblyLoader loader, CILModule module)
    {
        String retVal;

        if (!loader.TryGetResourceFor(module, out retVal))
        {
            throw new ArgumentException("Module was not loaded with this loader.");
        }
        return(retVal);
    }