Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

JObject vs ExpandoObject

Tags:

c#

json.net

Both helps to construct dynamic objects and I'm trying to understand if there Are any differences between them? is there any situation that we use JObject vs ExpandoObject?

like image 496
Venkatesh Muniyandi Avatar asked Apr 26 '26 06:04

Venkatesh Muniyandi


1 Answers

JObject is specific to use with JSON results returned by JSON.Net

ExpandoObject (And DynamicObject in the more specific case) is a general purpose dynamic object for use all over in .Net code. It isn't designed for any specific use case, and isn't optimized for one niche like JObject is.

Using JSON? use a JObject. General Purpose Dynamics? Use A DynamicObject(Or ExpandoObject as is appropriate)

like image 56
Tim Avatar answered Apr 27 '26 20:04

Tim



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!