AssemblyName.cs 1.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  1. //
  2. // System.Reflection/AssemblyName.cs
  3. //
  4. // Author:
  5. // Paolo Molaro ([email protected])
  6. //
  7. // (C) 2001 Ximian, Inc. http://www.ximian.com
  8. //
  9. using System;
  10. using System.Reflection;
  11. using System.Runtime.Serialization;
  12. namespace System.Reflection {
  13. public class AssemblyName : ISerializable // ICloneable, , IDeserializationCallback
  14. {
  15. string name;
  16. string codebase;
  17. Version version;
  18. public AssemblyName ()
  19. {
  20. name = null;
  21. }
  22. public AssemblyName (SerializationInfo si, StreamingContext sc)
  23. {
  24. name = si.GetString ("_Name");
  25. codebase = si.GetString ("_CodeBase");
  26. version = (Version)si.GetValue ("_Version", typeof (Version));
  27. }
  28. public virtual string Name {
  29. get {
  30. return name;
  31. }
  32. set {
  33. name = value;
  34. }
  35. }
  36. public virtual string CodeBase {
  37. get {
  38. return codebase;
  39. }
  40. set {
  41. codebase = value;
  42. }
  43. }
  44. public virtual Version Version {
  45. get {
  46. return version;
  47. }
  48. set {
  49. version = value;
  50. }
  51. }
  52. public override int GetHashCode ()
  53. {
  54. return name.GetHashCode ();
  55. }
  56. public override bool Equals (object o)
  57. {
  58. if (!(o is System.Reflection.AssemblyName))
  59. return false;
  60. AssemblyName an = (AssemblyName)o;
  61. if (an.name == this.name)
  62. return true;
  63. return false;
  64. }
  65. public void GetObjectData (SerializationInfo info, StreamingContext context)
  66. {
  67. info.AddValue ("_Name", name);
  68. info.AddValue ("_CodeBase", codebase);
  69. info.AddValue ("_Version", version);
  70. }
  71. }
  72. }