I've found a Serializeable Dictionary which works quite fine: http://www.jankowskimichal.pl/en/2010/10/serializabledictionary/
But I'm getting an exception whenever one of the objects in the dictionary is simply a list of strings. .NET is telling me it can't serialize it:
Serialize 'C:\bin\Debug\Settings\Default.xml' : System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: The type System.Collections.Generic.List`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]] may not be used in this context.
at System.Xml.Serialization.XmlSerializationWriter.WriteTypedPrimitive(String name, String ns, Object o, Boolean xsiType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterObject.Write1_Object(String n, String ns, Object o, Boolean isNullable, Boolean needType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterObject.Write2_anyType(Object o)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o)
at ShadowBot.Classes.SerializableDictionary`2.WriteXml(XmlWriter writer) in c:\Classes\SerializableDictionary.cs:line 114
at System.Xml.Serialization.XmlSerializationWriter.WriteSerializable(IXmlSerializable serializable, String name, String ns, Boolean isNullable, Boolean wrapped)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterShadowSettings.Write2_ShadowSettings(String n, String ns, ShadowSettings o, Boolean isNullable, Boolean needType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterShadowSettings.Write3_ShadowSettings(Object o)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
at System.Xml.Serialization.XmlSerializer.Serialize(Stream stream, Object o, XmlSerializerNamespaces namespaces)
at System.Xml.Serialization.XmlSerializer.Serialize(Stream stream, Object o)
at Classes.XmlSerializer.Serialize(String Path, Object Object) in c:\Classes\XmlSerializer.cs:line 29
Is this even possible? I'd like this capability and just assumed you could nest objects like this. If this isn't possible, is there a way I can just write the dictionary to disk (doesn't have to be XML) and then re-load it without me having to write custom wrappers for this? I was originally a mac developer and this type of serialization was quite simple, so maybe I'm missing something on .NET.
Edit: When trying odyss' example i get:
System.Runtime.Serialization.SerializationException: Type 'System.Collections.Generic.List`1[[System.String, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' with data contract name 'ArrayOfstring:http://schemas.microsoft.com/2003/10/Serialization/Arrays' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.
I've had similar issues with serializing generic lists. Try changing the list into an string array string[] before serializing and then back to a List<string> after deserializing. This is very easy to do and may solve your problem:
//List<string> to string[]
string[] sArray = sList.ToArray();
//string[] to List<string>
List<string> sList = sArray.ToList();
As an alternative, you might have better luck with System.Runtime.Serialization.DataContractSerializer. Example:
Dictionary<string, List<string>> dict = new Dictionary<string, List<string>>();
dict.Add("test", new List<string>() { "t", "b" });
StringBuilder xmlString = new StringBuilder();
using (XmlWriter writer = XmlWriter.Create(xmlString))
{
DataContractSerializer serializer = new DataContractSerializer(typeof(Dictionary<string, List<string>>));
serializer.WriteObject(writer, dict);
}
This generates:
<?xml version="1.0" encoding="utf-16"?><ArrayOfKeyValueOfstringArrayOfstringty7Ep6D1 xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.microsoft.com/2003/10/Serialization/Arrays"><KeyValueOfstringArrayOfstringty7Ep6D1><Key>test</Key><Value><string>t</string><string>b</string></Value></KeyValueOfstringArrayOfstringty7Ep6D1></ArrayOfKeyValueOfstringArrayOfstringty7Ep6D1>
Related
So I'm trying to use Dapper.net and I'm liking it. What I'm not liking is when I try to batch-insert entities and I get the following error thrown:
Invalid type owner for DynamicMethod.
at System.Reflection.Emit.DynamicMethod.Init(String name,
MethodAttributes attributes, CallingConventions callingConvention,
Type returnType, Type[] signature, Type owner, Module m, Boolean
skipVisibility, Boolean transparentMethod, StackCrawlMark& stackMark)
at System.Reflection.Emit.DynamicMethod..ctor(String name, Type
returnType, Type[] parameterTypes, Type owner, Boolean skipVisibility)
at Dapper.SqlMapper.CreateParamInfoGenerator(Identity identity,
Boolean checkForDuplicates, Boolean removeUnused, IList1 literals) in
D:\Dev\dapper-dot-net\Dapper NET40\SqlMapper.cs:line 3033 at
Dapper.SqlMapper.GetCacheInfo(Identity identity, Object
exampleParameters, Boolean addToCache) in D:\Dev\dapper-dot-net\Dapper
NET40\SqlMapper.cs:line 2138 at
Dapper.SqlMapper.<QueryImpl>d__611.MoveNext() in
D:\Dev\dapper-dot-net\Dapper NET40\SqlMapper.cs:line 1578 at
System.Collections.Generic.List1..ctor(IEnumerable1 collection)
at System.Linq.Enumerable.ToList[TSource](IEnumerable1 source) at
Dapper.SqlMapper.Query[T](IDbConnection cnn, String sql, Object param,
IDbTransaction transaction, Boolean buffered, Nullable1
commandTimeout, Nullable1 commandType) in
D:\Dev\dapper-dot-net\Dapper NET40\SqlMapper.cs:line 1479 at
Dapper.SqlMapper.Query(IDbConnection cnn, String sql, Object param,
IDbTransaction transaction, Boolean buffered, Nullable1
commandTimeout, Nullable1 commandType) in
D:\Dev\dapper-dot-net\Dapper NET40\SqlMapper.cs:line 1418 at
NinjaEvaluation.Data.Database.DapperWrapper.<>c__DisplayClass41.b__3(SqlConnection
sqlConnection, SqlTransaction transaction) in
c:\Projects\InHouse\ninjaevaluation\NinjaEvaluation\NinjaEvaluation.Data\Database\DapperWrapper.cs:line
52 at NinjaEvaluation.Data.Database.DapperWrapper.Invoke(Action`2
action) in
c:\Projects\InHouse\ninjaevaluation\NinjaEvaluation\NinjaEvaluation.Data\Database\DapperWrapper.cs:line
68
This happens in a completely normal situation when I run my query like this:
string sql = #" INSERT INTO XXX
(XXXId, AnotherId, ThirdId, Value, Comment)
VALUES
(#XXXId, #AnotherId, #ThirdId, #Value, #Comment)";
var parameters = command
.MyModels
.Select(model => new
{
XXXId= model.XXXId,
AnotherId= model.AnotherId,
ThirdId= model.ThirdId,
Value = model.Value,
Comment = model.Comment
})
.ToArray();
...
sqlConnection.Query(sql, parameters, commandType: commandType, transaction: transaction)
I found the following SO-thread started by someone having the same problem BUT the issue there seems to have been the .NET version (3.5) but I'm running .NET 4.5 and I can't figure out what the problem is.
Any suggestions?
I ran into this error when using an interface instead of the class:
Query<MyObject> worked, while Query<IMyObject> did not
It fails because this scenario using Query[<T>] isn't expecting an array / sequence of parameters. The Execute call-path does expect this, and unrolls the data automatically, executing the SQL once per item - but this isn't the case for Query[<T>], so it tries to create the dynamic method bound to the array (in your case), which isn't allowed. The code should probably detect this much earlier, and just say "nope, that isn't allowed".
You probably want to change your .ToArray() to .Single().
This will be clearer after the next build; the following passes:
public void SO30435185_InvalidTypeOwner()
{
try {
// not shown for brevity: something very similar to your code
Assert.Fail();
} catch(InvalidOperationException ex)
{
ex.Message.IsEqualTo("An enumerable sequence of parameters (arrays, lists, etc) is not allowed in this context");
}
}
I want to sort grouped columns of syncfusion Grid in my way, for that i have created a derived class by extending GridSortColumnDescriptor
[DataContract()]
[XmlInclude(typeof(ReviewerGridGroupingColumnSort)),XmlInclude(typeof(SynfusionCustomGridSorting))]
public class SynfusionCustomGridSorting : GridSortColumnDescriptor
{
private ReviewerGridGroupingColumnSort _sortGroupColumn= new ReviewerGridGroupingColumnSort ();
public SynfusionCustomGridSorting()
{
this.ShouldSerialize();
_sortGroupColumn.SortColumnName =this.Name;
this.Comparer = _sortGroupColumn;
}
}
ReviewerGridGroupingColumnSort is my custom sorting class.
Every thing is working fine but at the end i am getting this exception.
System.InvalidOperationException: The type
MarketWorkFlowWebApp.Common.SynfusionCustomGridSorting was not
expected. Use the XmlInclude or SoapInclude attribute to specify types
that are not known statically. at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterGridEngine.Write13_SortColumnDescriptor(String
n, String ns, SortColumnDescriptor o, Boolean isNullable, Boolean
needType) at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterGridEngine.Write45_GridTableDescriptor(String
n, String ns, GridTableDescriptor o, Boolean isNullable, Boolean
needType) at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterGridEngine.Write48_GridEngine(String
n, String ns, GridEngine o, Boolean isNullable, Boolean needType) at
Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriterGridEngine.Write49_GridEngine(Object
o)
What am I doing wrong here?
Custom sorting can be performed using GridGroupingControl.TableDescriptor.SortedColumns.Changing event. By using this event you can use the custom comparer and perform custom sorting. Please refer the below online documentation link for more details regarding custom sorting.
Documentation Link: http://help.syncfusion.com/ug/asp.net/default.htm#!documents/customsorting.htm
Please let us know if you have any other questions or concerns.
In WinRT when I call the count method in Queryable class for the IOrderedEnumerable instance it will throw the exception.
DoWork(emp); //Working fine
DoWork(emp.OrderBy(objects => objects.EmployeeId)); //throw exception..
public void DoWork(IEnumerable<object> collection)
{
var queryable = collection.AsQueryable();
int count = 0;
if (queryable != null)
count = queryable.Count();
else
throw new InvalidOperationException("Not able to get count");
//Some other operations using queryable...
}
Exception
System.InvalidOperationException was unhandled by user code
HResult=-2146233079
Message=The API 'System.Linq.OrderedEnumerable`2[[SfDataGrid.BusinessObjects, SfDataGrid, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null],[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]' cannot be used on the current platform. See http://go.microsoft.com/fwlink/?LinkId=248273 for more information.
Source=mscorlib
StackTrace:
at System.Reflection.Emit.DynamicILGenerator.GetTokenFor(RuntimeType rtType)
at System.Reflection.Emit.DynamicILGenerator.Emit(OpCode opcode, Type type)
at System.Linq.Expressions.Compiler.BoundConstants.EmitConstantFromArray(LambdaCompiler lc, Object value, Type type)
at System.Linq.Expressions.Compiler.BoundConstants.EmitConstant(LambdaCompiler lc, Object value, Type type)
at System.Linq.Expressions.Compiler.LambdaCompiler.EmitConstant(Object value, Type type)
at System.Linq.Expressions.Compiler.LambdaCompiler.EmitConstantExpression(Expression expr)
at System.Linq.Expressions.Compiler.LambdaCompiler.EmitExpression(Expression node, CompilationFlags flags)
at System.Linq.Expressions.Compiler.LambdaCompiler.EmitArguments(MethodBase method, IArgumentProvider args, Int32 skipParameters)
at System.Linq.Expressions.Compiler.LambdaCompiler.EmitMethodCall(MethodInfo mi, IArgumentProvider args, Type objectType, CompilationFlags flags)
at System.Linq.Expressions.Compiler.LambdaCompiler.EmitMethodCall(Expression obj, MethodInfo method, IArgumentProvider methodCallExpr, CompilationFlags flags)
at System.Linq.Expressions.Compiler.LambdaCompiler.EmitMethodCallExpression(Expression expr, CompilationFlags flags)
at System.Linq.Expressions.Compiler.LambdaCompiler.EmitExpression(Expression node, CompilationFlags flags)
at System.Linq.Expressions.Compiler.LambdaCompiler.EmitLambdaBody(CompilerScope parent, Boolean inlined, CompilationFlags flags)
at System.Linq.Expressions.Compiler.LambdaCompiler.EmitLambdaBody()
at System.Linq.Expressions.Compiler.LambdaCompiler.Compile(LambdaExpression lambda, DebugInfoGenerator debugInfoGenerator)
at System.Linq.EnumerableExecutor`1.Execute()
at System.Linq.EnumerableQuery`1.System.Linq.IQueryProvider.Execute[S](Expression expression)
at System.Linq.Queryable.Count[TSource](IQueryable`1 source)
at SfDataGrid.ViewModel.GetCount(IEnumerable`1 collection) in e:\DiskD\Support\I108101\SfDataGrid1022101733\SfDataGrid\SfDataGrid\ViewModel\ViewModel.cs:line 39
at SfDataGrid.ViewModel..ctor() in e:\DiskD\Support\I108101\SfDataGrid1022101733\SfDataGrid\SfDataGrid\ViewModel\ViewModel.cs:line 27
at SfDataGrid.SfDataGrid_XamlTypeInfo.XamlTypeInfoProvider.Activate_0_ViewModel() in e:\DiskD\Support\I108101\SfDataGrid1022101733\SfDataGrid\SfDataGrid\obj\Debug\XamlTypeInfo.g.cs:line 123
at SfDataGrid.SfDataGrid_XamlTypeInfo.XamlUserType.ActivateInstance() in e:\DiskD\Support\I108101\SfDataGrid1022101733\SfDataGrid\SfDataGrid\obj\Debug\XamlTypeInfo.g.cs:line 3679
It seems that IOrderedEnumerable<T>.AsQueryable() is implemented using dynamic code generation which is not available in WinRT. You could work around that by materializing it in a list before calling AsQueryable():
public void DoWork(IEnumerable<object> collection)
{
var queryable = collection.ToList().AsQueryable();
int count = 0;
if (queryable != null)
count = queryable.Count();
else
throw new InvalidOperationException("Not able to get count");
//Some other operations using queryable...
}
Unless you're working with very large collections performance shouldn't be much worse.
You must use IOrderable<object> instead of IEnumerable<object> as param for DoWork Method
IOrderable:
http://msdn.microsoft.com/en-us/library/microsoft.visualstudio.utilities.iorderable.aspx
IEnumerable:
http://msdn.microsoft.com/en-us/library/system.collections.ienumerable(v=vs.100).aspx
I am trying to return some data to a webservice using json and the JSon.Net library. One of my functions is an iterator method that lists data using yield return. When I try to serialize this return value, I am getting an invalid operation exception
I am using
string jsonEncoded = JsonConvert.SerializeObject(ret, Formatting.Indented); to serialize the return value.
The full stack trace of the exception is:
System.InvalidOperationException: This operation is only valid on generic types.
at System.RuntimeType.GetGenericTypeDefinition()
at Newtonsoft.Json.Serialization.JsonArrayContract..ctor(Type underlyingType) in c:\Temp\Json\Working\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonArrayContract.cs:line 148
at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateArrayContract(Type objectType) in c:\Temp\Json\Working\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\DefaultContractResolver.cs:line 686
at Newtonsoft.Json.Serialization.DefaultContractResolver.CreateContract(Type objectType) in c:\Temp\Json\Working\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\DefaultContractResolver.cs:line 800
at Newtonsoft.Json.Serialization.DefaultContractResolver.ResolveContract(Type type) in c:\Temp\Json\Working\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\DefaultContractResolver.cs:line 232
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.GetContractSafe(Object value) in c:\Temp\Json\Working\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 83
at Newtonsoft.Json.Serialization.JsonSerializerInternalWriter.Serialize(JsonWriter jsonWriter, Object value, Type objectType) in c:\Temp\Json\Working\Newtonsoft.Json\Src\Newtonsoft.Json\Serialization\JsonSerializerInternalWriter.cs:line 67
at Newtonsoft.Json.JsonSerializer.SerializeInternal(JsonWriter jsonWriter, Object value, Type objectType) in c:\Temp\Json\Working\Newtonsoft.Json\Src\Newtonsoft.Json\JsonSerializer.cs:line 753
at Newtonsoft.Json.JsonSerializer.Serialize(JsonWriter jsonWriter, Object value, Type objectType) in c:\Temp\Json\Working\Newtonsoft.Json\Src\Newtonsoft.Json\JsonSerializer.cs:line 668
at Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Type type, Formatting formatting, JsonSerializerSettings settings) in c:\Temp\Json\Working\Newtonsoft.Json\Src\Newtonsoft.Json\JsonConvert.cs:line 921
at Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Formatting formatting, JsonSerializerSettings settings) in c:\Temp\Json\Working\Newtonsoft.Json\Src\Newtonsoft.Json\JsonConvert.cs:line 893
at Newtonsoft.Json.JsonConvert.SerializeObject(Object value, Formatting formatting) in c:\Temp\Json\Working\Newtonsoft.Json\Src\Newtonsoft.Json\JsonConvert.cs:line 837
at AladdinWeb.Handlers.AladdinHandler.ProcessRequest(HttpContext context) in C:\Users\mehrlich\Projects\AladdinWeb\AladdinWeb\Server\Handlers\AladdinHandler.cs:line 85 [ 15/04/2013 11:24:24.68135 ]
The signature of the iterator method is:
public IEnumerable<dynamic> FunctionName() { ... }
As of now, I have a temporary solution in place by checking for calls to this function and calling ToList on the return value. This serializes just fine, but it is kind of an ugly solution since I need to have a special case for it (and any other iterator methods I might add). My guess is that this has to do with the IEnumerable not being enumerated.
Can I get Json.Net to serialize the result of my iterator functions or will I always need a special case like this? Let me know if any more information or source code is needed and I will post it.
More Info: I am using the .Net framework version 4.0 and I am using Json.Net version 5.0r2
Abridged Source Code of the Iterator Method
public IEnumerable<dynamic> FunctionName()
{
var methodList = typeof(Targets).GetMethods();
foreach (var m in methodList)
{
dynamic info = new ExpandoObject();
info.Name = m.Name;
info.Parameters = from param in m.GetParameters()
select param.Name;
yield return info;
}
}
Source Code of Method Call
...
object ret = null;
if (q == "FunctionName")
{
ret = FunctionName(); // This causes an exception to be thrown later
// ret = FunctionName().ToList(); // This does NOT throw an exception later
}
else
{
ret = DoOtherStuff(q, request);
}
// Serialize the result to JSON
// This line throws the exception
string jsonEncoded = JsonConvert.SerializeObject(ret, Formatting.Indented);
...
This issue is a bug with JSon.Net version 5.0r2, updating to 5.0r3 will fix this and in fact was the only reason for the 5.0r3 release.
I have tried to solve this but i get a crazy error when i do this?
Here's my first method --> Which holds the SQLQUERY
[WebMethod]
public ArrayList getAllaEgenskaperforenmall(string mall_id)
{
ArrayList dbFetch;
// string parameter1 = "mall_namn";
string sqlReadQuery = "SELECT DISTINCT d.egenskaper_namn FROM(SELECT egen.egenskaper_id, egen.egenskaper_namn, kopp.mall_id, kopp.egenskap_id, emall.mall_id as egenskapensmallid, emall.mall_namn FROM t_egenskaper as egen, t_kopplingmallegenskaper as kopp, t_egenskapsmall as emall WHERE kopp.mall_id = 1 AND kopp.egenskap_id = egen.egenskaper_id) as d";
dbFetch = executeReadSqlQueryArray(sqlReadQuery);
return dbFetch;
}
Then I have tried to set up a general webmethod that could fetch data for me.
public ArrayList executeReadSqlQueryArray(string sqlToFetchData, string parameter1 = "", string parameter2 = "", string parameter3 = "")
{
SqlConnection conn = new SqlConnection(mConnectionstring);
SqlCommand command = new SqlCommand();
SqlDataReader sqlReader;
ArrayList dataReadFromDatabase = new ArrayList();
command.Connection = conn;
command.Connection.Open();
command.CommandText = sqlToFetchData;
sqlReader = command.ExecuteReader();
while(sqlReader.Read())
{
object[] values = new object[sqlReader.FieldCount];
sqlReader.GetValues(values);
dataReadFromDatabase.Add(values);
}
command.Connection.Close();
return dataReadFromDatabase;
}
The error i get is this? Funny thing is that yesterday I think I managed to get it to do as I wanted!
System.InvalidOperationException: There was an error generating the XML document. ---> System.InvalidOperationException: The type System.Object[] may not be used in this context.
at System.Xml.Serialization.XmlSerializationWriter.WriteTypedPrimitive(String name, String ns, Object o, Boolean xsiType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write1_Object(String n, String ns, Object o, Boolean isNullable, Boolean needType)
at Microsoft.Xml.Serialization.GeneratedAssembly.XmlSerializationWriter1.Write8_ArrayOfAnyType(Object o)
at Microsoft.Xml.Serialization.GeneratedAssembly.ArrayListSerializer2.Serialize(Object objectToSerialize, XmlSerializationWriter writer)
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
--- End of inner exception stack trace ---
at System.Xml.Serialization.XmlSerializer.Serialize(XmlWriter xmlWriter, Object o, XmlSerializerNamespaces namespaces, String encodingStyle, String id)
at System.Xml.Serialization.XmlSerializer.Serialize(TextWriter textWriter, Object o, XmlSerializerNamespaces namespaces)
at System.Web.Services.Protocols.XmlReturnWriter.Write(HttpResponse response, Stream outputStream, Object returnValue)
at System.Web.Services.Protocols.HttpServerProtocol.WriteReturns(Object[] returnValues, Stream outputStream)
at System.Web.Services.Protocols.WebServiceHandler.WriteReturns(Object[] returnValues)
at System.Web.Services.Protocols.WebServiceHandler.Invoke()
The problem isn't with your code from getting from the DB as such, its that the WebMethod is trying to turn it into a string but it doesn't know what datatype it is. Currently its cast as Object (which can mean one of a million types).
If the datatype is of a simple singular data typeTry swapping away from ArrayList and making it a generic array, for example
List<String>
The problem is your array list contains a list of objects currently and the serialization processor doesn't know what to do with them. You could hard cast them from objects to a serializable format though to help or switch to a class (and make that implement serializable).
For example
[Serializable]
public class ProfileBasics
{
/// <summary>
/// Gets or sets the about me section
/// </summary>
[XmlElement("AboutMe")]
public string AboutMe {get; set;}
/// <summary>
/// Gets or sets the city name for the zip code
/// </summary>
[XmlElement("City")]
public string City {get; set;}
}
Then you could do List<ProfileBasics> and your web service should still work.