首页 > 解决方案 > F#:以编程方式操作标识符

问题描述

我正在与World Bank type provider合作,并试图操纵国家和指标。以。。。开始

let context = WorldBankDataProvider<"World Development Indicators">.GetDataContext ()

我可以得到Country一个

let france = context.Countries.France

并且以Indicator那个国家为基础

let franceCAIndicator = france.Indicators.``Current account balance (% of GDP)``

查看 的代码Runtime.WorldBank,似乎 anIndicator根据定义以国家/地区为基础,因为它有一个实例成员Code,该成员设置为国家或地区代码。但我希望能够引用某种没有国家对象的指标,然后将其与国家结合起来。也许一个IndicatorDescription是我所寻求的?这会产生一个IndicatorDescription

let CADescription = context.Topics.Trade.Indicators.``Current account balance (% of GDP)``

但是我怎样才能将它与 a 结合起来Country产生 a Indicator?在没有更优雅的解决方案的情况下,有没有办法以编程方式操作标识符

``Current account balance (% of GDP)``

即以某种方式将其绑定到另一个标识符,然后构造Indicator

france.Indicators.``Current account balance (% of GDP)``

从那个标识符和france

标签: f#identifiertype-providers

解决方案


推荐阅读