我创建的简单类型只包含一个依赖项属性“文本”返回字符串。从字符串到我喜欢的类型容易转换我写了这个代码:列表<Type1>到列表<Type2>转换WPF
public static implicit operator string(StringDP sdp)
{
return sdp.Text;
}
public static implicit operator StringDP(string str)
{
return new StringDP(str);
}
我希望能有类似的转换,从List<string>
到List<myType>
。我能做到吗?或者我必须使用这样的东西:
public List<string> Convert(List<myType> lst);
public List<myType> Convert(List<string> lst);
谢谢!