static bool SupportsAccessMode(string formatName, int accessType, out MsmqException msmqException) { msmqException = null; try { using (MsmqQueue msmqQueue = new MsmqQueue(formatName, accessType)) { msmqQueue.GetHandle(); } } catch (Exception ex) { msmqException = ex as MsmqException; if (null != msmqException) { return false; } throw; } return true; }
public static bool IsReadable(string formatName, out MsmqException ex) { return SupportsAccessMode(formatName, UnsafeNativeMethods.MQ_RECEIVE_ACCESS, out ex); }