【发布时间】:2020-10-24 20:30:48
【问题描述】:
我正在尝试将 F# 与 C# 混合使用。
在我的 C# Dependency 属性中,我需要 e.NewValue 的类型——它是 F#/Elmish.WPF 提供的对象
e.NewValue.GetType() 返回:
{Name = "ViewModel2" FullName = "Elmish.WPF.ViewModel2[[System.Object, System.Private.CoreLib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=7cec85d7bea7798e],[System.Object, System.Private.CoreLib,版本=4.0.0.0,文化=中性,PublicKeyToken=7cec85d7bea7798e]]"} System.Type {System.RuntimeType}
什么也没告诉我。
如何从 F#/Elmish.WPF 中获取对象的类/模块类型
谢谢。
TIA
作为完整披露,这来自:
public static readonly DependencyProperty VisitProperty =
DependencyProperty.Register("Visit", typeof(IInnerRow), typeof(DataGridAnnotationControl), new PropertyMetadata(null, (s, e) =>
{
var sender = s as DataGridAnnotationControl;
var visit = (IInnerRow)e.NewValue;
if (visit != null)
sender.LastName = visit.LastName;
}));
但是,我不知道如何从 Elmish 转换 NewValue,所以希望 GetType() 能对此有所了解。
【问题讨论】:
-
e.NewValue的类型显然是Elmish.WPF.ViewModel<Object, Object>。 “获取类型”对您意味着什么? -
@FyodorSoikin 你是对的。完整代码如上,我不知道如何转换来自 Elmish.WPF 视图模型的 e.NewValue。我希望 GetType() 能对此有所了解。谢谢。
-
如何转换成什么?
标签: f# elmish-wpf