dynamicobject

Enum values for Office interop via dynamic object

南楼画角 提交于 2019-12-02 03:29:09
问题 I am using COM interop for Word automation within my Silverlight-Ouf-Of-Browser application. This means that I can't reference COM directly but instead I rely on dynamic. Now I would like to call the following method: Range.Collapse(WdCollapseDirection direction). How do I find out what values are mapped to the individual enum values (e.g.does wdCollapseEnd have a value of 1 or 2)? Kind regards! PS: For further info on the method signature see http://msdn.microsoft.com/de-de/library/microsoft

Enum values for Office interop via dynamic object

亡梦爱人 提交于 2019-12-02 02:25:13
I am using COM interop for Word automation within my Silverlight-Ouf-Of-Browser application. This means that I can't reference COM directly but instead I rely on dynamic. Now I would like to call the following method: Range.Collapse(WdCollapseDirection direction). How do I find out what values are mapped to the individual enum values (e.g.does wdCollapseEnd have a value of 1 or 2)? Kind regards! PS: For further info on the method signature see http://msdn.microsoft.com/de-de/library/microsoft.office.interop.word.range.collapse Tools like Reflector make that fairly simple. You could even use

Is there mongodb C# driver support System.Dynamic.DynamicObject in .NET 4?

两盒软妹~` 提交于 2019-11-30 04:52:23
Im working on a project that use .NET Razor and mongodb. I would like to do something like this: @{ var feeds = DP.Database.GetCollection("feeds").FindAll(); } <ul> @foreach (dynamic feed in feeds) { <li>@feed.message - @feed.from.name</li> } </ul> However, the current mongodb C# driver FindAll() return collection of BsonDocument which does not support dynamic object. Anybody know a .NET 4 dynamic supported mongodb C# driver? Thanks a lot Currently, there is no support for dynamic in the MongoDB driver. This is because it is based on .NET 3.5. However, since a .NET 4.0 assembly can reference a

Is there mongodb C# driver support System.Dynamic.DynamicObject in .NET 4?

烈酒焚心 提交于 2019-11-29 02:26:13
问题 Im working on a project that use .NET Razor and mongodb. I would like to do something like this: @{ var feeds = DP.Database.GetCollection("feeds").FindAll(); } <ul> @foreach (dynamic feed in feeds) { <li>@feed.message - @feed.from.name</li> } </ul> However, the current mongodb C# driver FindAll() return collection of BsonDocument which does not support dynamic object. Anybody know a .NET 4 dynamic supported mongodb C# driver? Thanks a lot 回答1: Currently, there is no support for dynamic in the

C# How to serialize (JSON, XML) normal properties on a class that inherits from DynamicObject

自古美人都是妖i 提交于 2019-11-28 13:49:05
I am trying to serialize an instance of a class that inherits from DynamicObject. I've had no trouble getting the dynamic properties to serialize (not demonstrated here for brevity), but "normal" properties don't seem to make the trip. I experience the same problem regardless of serialization class: it's the same for JavaScriptSerializer, JsonConvert, and XmlSerializer. public class MyDynamicClass : DynamicObject { public string MyNormalProperty { get; set; } } ... MyDynamicClass instance = new MyDynamicClass() { MyNormalProperty = "Hello, world!" }; string json = JsonConvert.SerializeObject

Loop DynamicObject properties

对着背影说爱祢 提交于 2019-11-28 07:58:00
I'm trying to understand the DynamicObject type. Found this MSDN article to be very consise and clear as how to create and use DynamicObject: http://msdn.microsoft.com/en-us/library/system.dynamic.dynamicobject.aspx The article contains a simple DynamicDictionary class that inherits from DynamicObject. Now I want to iterate over my dynamically created DynamicObject properties: dynamic d = new DynamicDictionary(); d.Name = "Myname"; d.Number = 1080; foreach (var prop in d.GetType().GetProperties()) { Console.Write prop.Key; Console.Write prop.Value; } Obviously that does not work. I want to

C# 4.0 Dynamic vs Expando… where do they fit?

為{幸葍}努か 提交于 2019-11-27 18:56:58
I am trying to learn all the new goodies that come with C# 4.0. I am failing to understand the differences between the DynamicObject and ExpandoObject types. It seems like DynamicObject is used e.g. when you want to access variables from Python scripts and ExpandoObject when talking with COM/Office objects. Am I right? What is the difference in their use? Expando is a dynamic type to which members can be added (or removed) at runtime. dynamic is designed to allow .NET to interoperate with types when interfacing with dynamic typing languages such as Python and JavaScript. So, if you need to

dynamic does not contain a definition for a property from a project reference

自作多情 提交于 2019-11-27 17:46:47
I am getting an error that says: 'object' does not contain a definition for 'Title' all the code is also on github I have a ConsoleApplication1 that looks like this namespace ConsoleApplication1 { class Program { static void Main(string[] args) { Movie m = new Movie(); var o = new { Title = "Ghostbusters", Rating = "PG" }; Console.WriteLine(m.PrintMovie(o)); } } } and Movie.cs public class Movie : DynamicObject { public string PrintMovie(dynamic o) { return string.Format("Title={0} Rating={1}", o.Title, o.Rating); } } it works fine from the SAME project, but if I add ConsoleApplication2 with a

Binding DynamicObject to a DataGrid with automatic column generation?

萝らか妹 提交于 2019-11-27 13:46:29
I'm still experimenting with DynamicObjects. Now I need some information: I'm trying to bind an object inheriting from DynamicObject to a WPF DataGrid (not Silverlight). How do I get the DataGrid to automatically create its columns from the available public properties of the object that are typically generated at runtime? Is that possible actually? There is no uniform way to query dynamic properties, generally it's expected that you know them ahead of time. With DynamicObject , implementers may override GetMemberNames and that generally gives you the properties, however it is really meant for

C# How to serialize (JSON, XML) normal properties on a class that inherits from DynamicObject

别来无恙 提交于 2019-11-27 07:55:08
问题 I am trying to serialize an instance of a class that inherits from DynamicObject. I've had no trouble getting the dynamic properties to serialize (not demonstrated here for brevity), but "normal" properties don't seem to make the trip. I experience the same problem regardless of serialization class: it's the same for JavaScriptSerializer, JsonConvert, and XmlSerializer. public class MyDynamicClass : DynamicObject { public string MyNormalProperty { get; set; } } ... MyDynamicClass instance =