// Ravindra (rkumar@novell.com)
//
// Copyright (C) 2002 Ximian, Inc. http://www.ximian.com
-// Copyright (C) 2003,2004,2006 Novell, Inc (http://www.novell.com)
+// Copyright (C) 2003,2004,2006,2008 Novell, Inc (http://www.novell.com)
//
// Permission is hereby granted, free of charge, to any person obtaining
// a copy of this software and associated documentation files (the
CultureInfo culture,
object value)
{
+ if (culture == null)
+ culture = CultureInfo.CurrentCulture;
string s = value as string;
if (s == null)
return base.ConvertFrom (context, culture, value);
object value,
Type destinationType)
{
+ if (culture == null)
+ culture = CultureInfo.CurrentCulture;
// LAMESPEC: "The default implementation calls the ToString method
// of the object if the object is valid and if the destination
// type is string." MS does not behave as per the specs.
// Oh well, we have to be compatible with MS.
- if ((destinationType == typeof (string)) && (value is Size))
- return ((Size) value).Width.ToString(culture) + culture.TextInfo.ListSeparator
- + " " + ((Size) value).Height.ToString(culture);
-
- if (destinationType == typeof (InstanceDescriptor) && value is Size) {
- Size s = (Size) value;
- ConstructorInfo ctor = typeof(Size).GetConstructor (new Type[] {typeof(int), typeof(int)});
- return new InstanceDescriptor (ctor, new object[] {s.Width, s.Height});
+ if (value is Size) {
+ Size size = (Size) value;
+ if (destinationType == typeof (string)) {
+ return size.Width.ToString (culture) + culture.TextInfo.ListSeparator
+ + " " + size.Height.ToString (culture);
+ } else if (destinationType == typeof (InstanceDescriptor)) {
+ ConstructorInfo ctor = typeof(Size).GetConstructor (new Type[] {typeof(int), typeof(int)});
+ return new InstanceDescriptor (ctor, new object[] { size.Width, size.Height });
+ }
}
return base.ConvertTo (context, culture, value, destinationType);