Click here to Skip to main content
15,887,214 members
Articles / Programming Languages / C#

NetMX - a JMX port to the .NET world

Rate me:
Please Sign up or sign in to vote.
5.00/5 (1 vote)
10 Mar 2008LGPL34 min read 39.6K   268   11  
An introduction to NetMX - a lightweight .NET management solution.
using System;
using System.Globalization;
using System.Runtime.Serialization;

namespace NetMX.OpenMBean.Mapper
{
   [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1032:ImplementStandardExceptionConstructors", Justification = "Other constructos do not make sense"), Serializable]
   public sealed class MissingResourceItemException : NetMXException
   {
      private readonly string _itemName;
      private readonly string _resourceName;
      private readonly string _assemblyName;

      /// <summary>
		/// Creates new <see cref="MissingResourceItemException"/> object.
		/// </summary>		
		public MissingResourceItemException(string itemName, string resourceName, string assemblyName)
			: base(string.Format(CultureInfo.CurrentCulture, "Unable to retrieve item \"{0}\" from resource \"{1}\" of assembly {2}.", itemName, resourceName, assemblyName))
		{
         _itemName = itemName;
         _resourceName = resourceName;
         _assemblyName = assemblyName;
		}

      private MissingResourceItemException(SerializationInfo info, StreamingContext context)
			: base(info, context)
		{
         _itemName = info.GetString("itemName");
         _resourceName = info.GetString("resourceName");
         _assemblyName = info.GetString("assemblyName");
		}
      [System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Design", "CA1062:ValidateArgumentsOfPublicMethods"), System.Security.Permissions.SecurityPermission(System.Security.Permissions.SecurityAction.LinkDemand, Flags = System.Security.Permissions.SecurityPermissionFlag.SerializationFormatter)]
      public override void GetObjectData(SerializationInfo info, StreamingContext context)
      {
         base.GetObjectData(info, context);
         info.AddValue("itemName", _itemName);
         info.AddValue("resourceName", _resourceName);
         info.AddValue("assemblyName", _assemblyName);
      }

      /// <summary>
      /// Name of resource item that failed to be retrieved.
      /// </summary>
      public string ItemName
      {
         get { return _itemName; }
      }
      /// <summary>
      /// Resource file name that was to be searched.
      /// </summary>
      public string ResourceName
      {
         get { return _resourceName; }
      }
      /// <summary>
      /// Assembly containing resource being searched for.
      /// </summary>
      public string AssemblyName
      {
         get { return _assemblyName; }
      }      
   }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The GNU Lesser General Public License (LGPLv3)


Written By
Software Developer (Senior) VSoft
Poland Poland
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions