2009-11-02 Zoltan Varga <vargaz@gmail.com>
[mcs.git] / class / Mono.Debugger.Soft / Mono.Debugger / StructMirror.cs
blob396ae926e08399084980efc9d658a95c9a0187bf
1 using System;
2 using System.Collections.Generic;
4 namespace Mono.Debugger
6 /*
7 * Represents a valuetype value in the debuggee
8 */
9 public class StructMirror : Value {
11 TypeMirror type;
12 Value[] fields;
14 internal StructMirror (VirtualMachine vm, TypeMirror type, Value[] fields) : base (vm, 0) {
15 this.type = type;
16 this.fields = fields;
19 public TypeMirror Type {
20 get {
21 return type;
25 public Value[] Fields {
26 get {
27 return fields;
31 public Value this [String field] {
32 get {
33 FieldInfoMirror[] field_info = Type.GetFields ();
34 for (int i = 0; i < field_info.Length; ++i)
35 if (field_info [i].Name == field)
36 return Fields [i];
37 throw new ArgumentException ("Unknown struct field '" + field + "'.", "field");
41 internal void SetField (int index, Value value) {
42 fields [index] = value;
45 public Value InvokeMethod (ThreadMirror thread, MethodMirror method, IList<Value> arguments) {
46 return ObjectMirror.InvokeMethod (vm, thread, method, this, arguments);