IronRuby를 사용하는 확장 가능한 저장소로 Revit API를 사용하고 있으며 IronRuby 문제라고 생각합니다. 나는 제레미 Tannik의 된 Revit 블로그에서 아이언 루비이 C# 예제를 재현하기 위해 노력하고있어 :IronRapy가 인수로 .NET 인터페이스 필요
// create a field to store a string map
FieldBuilder fieldBuilder =
schemaBuilder.AddMapField("StringMap", typeof(string), typeof(string));
. . .
// set the value for this entity
IDictionary<string, string> stringMap = new Dictionary<string, string>();
stringMap.Add("key1", "value1");
stringMap.Add("key2", "value2");
entity.Set<IDictionary<string, string>>(field, stringMap);
내가 아이언 루비에있는 것 같은 종류의 생각 일을하려고 :
# create a field to store a string map
schema_builder.AddMapField("manually_checked", System::String.to_clr_type, System::Boolean.to_clr_type)
. . .
# set the value for this entity
xDict = Dictionary[System::String,System::Boolean].new
IDictionary_module = xDict.class.ancestors.detect { |i| i.to_s ==
"System::Collections::Generic::IDictionary[System::String, System::Boolean]" }
xDict.Add("blah", true)
# all three of these fail with the same error
x.Set("manually_checked", xDict)
x.method(:Set).of(Dictionary[System::String,System::Boolean]).call("manually_checked", xDict)
x.method(:Set).of(IDictionary_module).call("manually_checked", xDict)
세가
지원되지 않는 종류 : System.Collections.Generic.Dictionary`2 [선택 System.String, mscorlib에, 버전 = 4.0.0.0, 구리 내가 설정 호출 방법()의 같은 메시지와 함께 실패 lture = 중립, PublicKeyToken = b77a5c561934e089], [선택 System.Boolean, mscorlib에, 버전 = 4.0.0.0, 문화 = 중립, PublicKeyToken = b77a5c561934e089] 나를 생각한다 (InvalidOperationException이)
은 " Dictionary`2 "는 오류 메시지에서 조상 배열의 IDictionary [System :: String, System :: Boolean]의 위치 인 xDict.class.ancestors [2]에 대한 참조입니다.
그래서, 내 질문은,이 허용하거나, Ruby 모듈과 .NET 인터페이스의 차이로 인해 showstopper에 대해 부딪히는 IronRuby 구문이 있습니까?
감사합니다. 불행히도, IronRuby의 효과적인 죽음으로 인해 모든 것을 C#으로 변환하게되었습니다. C'est la vie. – RealHandy