2002-07-10 Gonzalo Paniagua Javier <gonzalo@ximian.com>
[mono.git] / mcs / class / corlib / System / RuntimeFieldHandle.cs
1 //
2 // System.RuntimeFieldHandle.cs
3 //
4 // Author:
5 //   Miguel de Icaza (miguel@ximian.com)
6 //
7 // (C) Ximian, Inc.  http://www.ximian.com
8 //
9
10 using System.Runtime.Serialization;
11 using System.Globalization;
12
13 namespace System {
14
15         [MonoTODO]
16         [Serializable]
17         public struct RuntimeFieldHandle : ISerializable {
18                 IntPtr value;
19                 
20                 public IntPtr Value {
21                         get {
22                                 return (IntPtr) value;
23                         }
24                 }
25
26                 RuntimeFieldHandle (SerializationInfo info, StreamingContext context)
27                 {
28                         Type t;
29                         
30                         if (info == null)
31                                 throw new ArgumentNullException ("info");
32
33                         t = (Type) info.GetValue ("TypeObj", typeof (Type));
34
35                         value = t.TypeHandle.Value;
36                         if (value == (IntPtr) 0)
37                                 throw new SerializationException (Locale.GetText ("Insufficient state"));
38                 }
39                 
40                 public void GetObjectData (SerializationInfo info, StreamingContext context)
41                 {
42                         info.AddValue ("TypeObj", value, value.GetType ());
43                 }
44         }
45 }