<p>Is there anyplace where one can download a virtual machine containing a working install of some Linux distro with Globus Toolkit and some development tools (Java) for testing purposes? A real deployment of a grid is more complicated but I just need something portable, for development.</p>

[{'answer_id': 8632, 'author': 'Greg Hewgill', 'author_id': 893, 'author_profile': 'https://Stackoverflow.com/users/893', 'pm_score': 2, 'selected': False, 'text': '<p>You could possibly use a construct such as a <a href="http://www.boost.org/community/generic_programming.html#traits" rel="nofollow noreferrer">traits class</a>. In this way, you would have a parameterised helper class that knows how to convert a string to a value of its own type. Then your getter might look like this:</p>\n\n<pre><code>get { return StringConverter&lt;DataType&gt;.FromString(base.Value); }\n</code></pre>\n\n<p>Now, I must point out that my experience with parameterised types is limited to C++ and its templates, but I imagine there is some way to do the same sort of thing using C# generics.</p>\n'}, {'answer_id': 8633, 'author': 'lubos hasko', 'author_id': 275, 'author_profile': 'https://Stackoverflow.com/users/275', 'pm_score': 10, 'selected': True, 'text': "<p>I am not sure whether I understood your intentions correctly, but let's see if this one helps.</p>\n\n<pre><code>public class TypedProperty&lt;T&gt; : Property where T : IConvertible\n{\n    public T TypedValue\n    {\n        get { return (T)Convert.ChangeType(base.Value, typeof(T)); }\n        set { base.Value = value.ToString();}\n    }\n}\n</code></pre>\n"}, {'answer_id': 8636, 'author': 'dbkk', 'author_id': 838, 'author_profile': 'https://Stackoverflow.com/users/838', 'pm_score': 4, 'selected': False, 'text': '<p>For many types (integer, double, DateTime etc), there is a static Parse method. You can invoke it using reflection:</p>\n\n<pre><code>MethodInfo m = typeof(T).GetMethod("Parse", new Type[] { typeof(string) } );\n\nif (m != null)\n{\n    return m.Invoke(null, new object[] { base.Value });\n}\n</code></pre>\n'}, {'answer_id': 1833128, 'author': 'Tim Coker', 'author_id': 222951, 'author_profile': 'https://Stackoverflow.com/users/222951', 'pm_score': 6, 'selected': False, 'text': '<p>lubos hasko\'s method fails for nullables.  The method below will work for nullables.  I didn\'t come up with it, though.  I found it via Google:  <a href="http://web.archive.org/web/20101214042641/http://dogaoztuzun.com/post/C-Generic-Type-Conversion.aspx" rel="noreferrer">http://web.archive.org/web/20101214042641/http://dogaoztuzun.com/post/C-Generic-Type-Conversion.aspx</a> Credit to "Tuna Toksoz"</p>\n\n<p>Usage first:  </p>\n\n<pre><code>TConverter.ChangeType&lt;T&gt;(StringValue);  \n</code></pre>\n\n<p>The class is below.  </p>\n\n<pre><code>public static class TConverter\n{\n    public static T ChangeType&lt;T&gt;(object value)\n    {\n        return (T)ChangeType(typeof(T), value);\n    }\n\n    public static object ChangeType(Type t, object value)\n    {\n        TypeConverter tc = TypeDescriptor.GetConverter(t);\n        return tc.ConvertFrom(value);\n    }\n\n    public static void RegisterTypeConverter&lt;T, TC&gt;() where TC : TypeConverter\n    {\n\n        TypeDescriptor.AddAttributes(typeof(T), new TypeConverterAttribute(typeof(TC)));\n    }\n}\n</code></pre>\n'}, {'answer_id': 4471618, 'author': 'Mastahh', 'author_id': 345818, 'author_profile': 'https://Stackoverflow.com/users/345818', 'pm_score': 0, 'selected': False, 'text': '<pre><code>public class TypedProperty&lt;T&gt; : Property\n{\n    public T TypedValue\n    {\n        get { return (T)(object)base.Value; }\n        set { base.Value = value.ToString();}\n    }\n}\n</code></pre>\n\n<p>I using converting via an object. It is a little bit simpler.</p>\n'}, {'answer_id': 17547039, 'author': 'Dinesh Rathee', 'author_id': 2564323, 'author_profile': 'https://Stackoverflow.com/users/2564323', 'pm_score': 4, 'selected': False, 'text': '<pre><code>TypeDescriptor.GetConverter(PropertyObject).ConvertFrom(Value)\n</code></pre>\n\n<p><code>TypeDescriptor</code> is class having method <code>GetConvertor</code> which accept a <code>Type</code> object and then you can call <code>ConvertFrom</code> method to convert the <code>value</code> for that specified object.</p>\n'}, {'answer_id': 30614023, 'author': 'anhoppe', 'author_id': 1178267, 'author_profile': 'https://Stackoverflow.com/users/1178267', 'pm_score': 0, 'selected': False, 'text': '<p>I used lobos answer and it works. But I had a problem with the conversion of <strong>doubles</strong> because of the culture settings. So I added</p>\n\n<pre><code>return (T)Convert.ChangeType(base.Value, typeof(T), CultureInfo.InvariantCulture);\n</code></pre>\n'}, {'answer_id': 31883872, 'author': 'Bob C', 'author_id': 5049261, 'author_profile': 'https://Stackoverflow.com/users/5049261', 'pm_score': 2, 'selected': False, 'text': '<p>Check the static <code>Nullable.GetUnderlyingType</code>.\n- If the underlying type is null, then the template parameter is not <code>Nullable</code>, and we can use that type directly\n- If the underlying type is not null, then use the underlying type in the conversion.</p>\n\n<p>Seems to work for me:</p>\n\n<pre><code>public object Get( string _toparse, Type _t )\n{\n    // Test for Nullable&lt;T&gt; and return the base type instead:\n    Type undertype = Nullable.GetUnderlyingType(_t);\n    Type basetype = undertype == null ? _t : undertype;\n    return Convert.ChangeType(_toparse, basetype);\n}\n\npublic T Get&lt;T&gt;(string _key)\n{\n    return (T)Get(_key, typeof(T));\n}\n\npublic void test()\n{\n    int x = Get&lt;int&gt;("14");\n    int? nx = Get&lt;Nullable&lt;int&gt;&gt;("14");\n}\n</code></pre>\n'}, {'answer_id': 45555953, 'author': 'Todd Menier', 'author_id': 62600, 'author_profile': 'https://Stackoverflow.com/users/62600', 'pm_score': 0, 'selected': False, 'text': '<p>Yet another variation. Handles Nullables, as well as situations where the string is null and T is <em>not</em> nullable.</p>\n\n<pre><code>public class TypedProperty&lt;T&gt; : Property where T : IConvertible\n{\n    public T TypedValue\n    {\n        get\n        {\n            if (base.Value == null) return default(T);\n            var type = Nullable.GetUnderlyingType(typeof(T)) ?? typeof(T);\n            return (T)Convert.ChangeType(base.Value, type);\n        }\n        set { base.Value = value.ToString(); }\n    }\n}\n</code></pre>\n'}, {'answer_id': 55136934, 'author': 'Ghominejad', 'author_id': 954142, 'author_profile': 'https://Stackoverflow.com/users/954142', 'pm_score': 3, 'selected': False, 'text': '<p>With inspiration from the <a href="https://stackoverflow.com/questions/8625/generic-type-conversion-from-string/31883872#31883872">Bob</a>\'s answer, these extensions also support null value conversion and all primitive conversion back and fourth.</p>\n\n<pre><code>public static class ConversionExtensions\n{\n        public static object Convert(this object value, Type t)\n        {\n            Type underlyingType = Nullable.GetUnderlyingType(t);\n\n            if (underlyingType != null &amp;&amp; value == null)\n            {\n                return null;\n            }\n            Type basetype = underlyingType == null ? t : underlyingType;\n            return System.Convert.ChangeType(value, basetype);\n        }\n\n        public static T Convert&lt;T&gt;(this object value)\n        {\n            return (T)value.Convert(typeof(T));\n        }\n}\n</code></pre>\n\n<p>Examples</p>\n\n<pre><code>            string stringValue = null;\n            int? intResult = stringValue.Convert&lt;int?&gt;();\n\n            int? intValue = null;\n            var strResult = intValue.Convert&lt;string&gt;();\n</code></pre>\n'}, {'answer_id': 60565090, 'author': 'Hemendra', 'author_id': 10220245, 'author_profile': 'https://Stackoverflow.com/users/10220245', 'pm_score': 0, 'selected': False, 'text': '<p>You can do it in one line as below:</p>\n\n<pre><code>YourClass obj = (YourClass)Convert.ChangeType(YourValue, typeof(YourClass));\n</code></pre>\n\n<p>Happy coding ;)</p>\n'}]
['https://Stackoverflow.com/questions/8626', 'https://Stackoverflow.com', 'https://Stackoverflow.com/users/1065/']