+ public string [] GetValueNames ()
+ {
+ AssertNotMarkedForDeletion ();
+
+ ICollection keys = values.Keys;
+
+ string [] vals = new string [keys.Count];
+ keys.CopyTo (vals, 0);
+ return vals;
+ }
+
+#if NET_2_0
+ //
+ // This version has to do argument validation based on the valueKind
+ //
+ public void SetValue (string name, object value, RegistryValueKind valueKind)
+ {
+ SetDirty ();
+
+ if (name == null)
+ name = string.Empty;
+
+ switch (valueKind){
+ case RegistryValueKind.String:
+ if (value is string){
+ values [name] = value;
+ return;
+ }
+ break;
+ case RegistryValueKind.ExpandString:
+ if (value is string){
+ values [name] = new ExpandString ((string)value);
+ return;
+ }
+ break;
+
+ case RegistryValueKind.Binary:
+ if (value is byte []){
+ values [name] = value;
+ return;
+ }
+ break;
+
+ case RegistryValueKind.DWord:
+ if (value is long &&
+ (((long) value) < Int32.MaxValue) &&
+ (((long) value) > Int32.MinValue)){
+ values [name] = (int) ((long)value);
+ return;
+ }
+ if (value is int){
+ values [name] = value;
+ return;
+ }
+ break;
+
+ case RegistryValueKind.MultiString:
+ if (value is string []){
+ values [name] = value;
+ return;
+ }
+ break;
+
+ case RegistryValueKind.QWord:
+ if (value is int){
+ values [name] = (long) ((int) value);
+ return;
+ }
+ if (value is long){
+ values [name] = value;
+ return;
+ }
+ break;
+ default:
+ throw new ArgumentException ("unknown value", "valueKind");
+ }
+ throw new ArgumentException ("Value could not be converted to specified type", "valueKind");
+ }
+#endif
+