示例#1
0
        /// <summary>
        /// Creates ExceptionBase with message from resx files and inner exception.
        /// </summary>
        /// <param name="resourceKey">Resource key in resx file.</param>
        /// <param name="cultureName">Culture where the resource resides. Provide culture name in format of languagecode2-country/regioncode2.</param>
        /// <param name="ex">Inner exception.</param>
        /// <returns>Returns new instance of ExceptionBase.</returns>
        public static ExceptionBase CreateExceptionFromResource(string resourceKey, string cultureName, System.Exception ex)
        {
            string        message       = ApplicationFoundation.Current.ResourceLocalization.GetResourceValue(resourceKey, cultureName);
            ExceptionBase baseException = new ExceptionBase(message, ex);

            return(baseException);
        }
示例#2
0
        /// <summary>
        /// Throws exception with specified message.
        /// </summary>
        /// <param name="exMessage">Exception message.</param>
        public static void Throw <T>(string exMessage) where T : ExceptionBase, new()
        {
            T exception = new ExceptionBase(exMessage) as T;

            throw exception;
        }