v9 Metastorm List to generic List<T>

hi

Is there any simple way to cast/convert Metastorm List type (containing KeyValuePair<string, string>) to .net generic List<KeyValuePair<string, string>> type?

I'm trying to make extension methods for ProcessContext.UserInput fields to get values by column name, not by index. Unfortunatelly i even don't know if UserInput contains KeyValuePair types or it is just simple array:

 

public static string Find(this IList list, string columnName)
    {
        
        var l = (List<KeyValuePair<string,string>>)list.KeyValuePairList();
        
        KeyValuePair<string, string> found = l.FindLast(f => f.Value == columnName);
        
        if(!string.IsNullOrEmpty(found.Key))
            return found.Key;
        else
            return string.Empty;
        
    }

Tagged:

Comments

  • I dont know if this will help you, but it solved my problems of the metastorm "List" not having the methods I need which are available on the System "List".

     

    Basically once you add LINQ to the script (using System.Linq;), a lot of the default C# List methods open up.