I need some suggestions on how to import data into multiple list objects using Dapper and then serialize the lists into proper JSON format. Please share your suggestions. Sample JSON fo. Jun 11, 2013 Hello everybody, I need to serialize a list of string text to xml and then desearialze it. List looks like 10, 6, 7, 11 and etc. How should I do this? How to implement custom JsonConverter in JSON.NET to deserialize a List of base class objects? 393 How can I change property names when serializing with Json.net?
Active1 year, 7 months ago
I have this, and i want to serialize to xml both lists :
I used SerializeToXML method that i found in other tutorial but when i run it an error shows up
'Error 1 Inconsistent accessibility: parameter type 'System.Collections.Generic.List' is less accessible than method 'AppPrueba.Form1.SerializeToXML(System.Collections.Generic.List)' C:Users722825DesktopSanti CosasAppPruebaAppPruebaForm1.cs 27 28 AppPrueba'
Thanks in advance if you can help me!
user2115574user2115574
3 Answers
All the classes that you are trying to serialize to xml should be public. And for collection serialization you cannot use generics - either use untyped collections, like, ArrayList , or create a non-generic descendant class form List .
alexalex
10.7k33 gold badges3636 silver badges5757 bronze badges
agen is private and SerializeToXML is public static. You need agen public
6,32444 gold badges1919 silver badges4040 bronze badges
Your error says that the variabel List agen = new List(); needs to be public like this: public List agen = new List();
andreasnicoandreasnico
Not the answer you're looking for? Browse other questions tagged c#xmlserialization or ask your own question.
Active4 years, 3 months ago
I need some suggestions on how to import data into multiple list objects using Dapper and then serialize the lists into proper JSON format. Please share your suggestions. THANKS!
1. Sample JSON format
C Serialize List Of Objects 2017
2. Classes
3. Data coming in from sql query
4. Dapper code I am trying to implement Gta vice city game.
4. Serializing to JSON
David L
24.7k66 gold badges4646 silver badges7676 bronze badges
1111lt1111lt
closed as off-topic by Panagiotis Kanavos, Ňɏssa Pøngjǣrdenlarp, Martijn, Paul Turner, user35443Jun 19 '15 at 15:48
This question appears to be off-topic. The users who voted to close gave this specific reason:
C# Serialize List Of Strings1 Answer
The first issue is that you are invoking a stored procedure without specifying that the command type is a stored procedure. This will mis-translate your proc name into a sql command which will obviously fail.
However, based on your updated comment, the second problem is that you are mis-using dapper's multi mapper functionality. This functionality is for mapping multiple tables to multiple objects. However, it seems like your stored procedure is giving you a flattened object and you need to break apart unique records based on student id, mapping the email addresses to your email address property.
Dynamic works really well for this since we can map the data on the fly.
David L
C# Serialize Object To XmlDavid L
24.7k66 gold badges4646 silver badges7676 bronze badges
Not the answer you're looking for? Browse other questions tagged c#jsondapper-extensions or ask your own question.Comments are closed.
|
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |