|
Hi, I'm trying to use the System.Xml.Linq namespace to do some xml generation/parsing. Is there any way to get this to work? I get these weird messages in Unity when I try to use XElement. The following code gives error messages:
This code works:
The error message I get is:
(comments are locked)
|
|
from: http://answers.unity3d.com/questions/12884/does-a-plugin-work-independent-of-mono-framework.html
I guess it's not implemented in the version of Mono used by Unity and thus not available. A suggestion I read elsewhere was to use a C++ plugin that calls into a .Net assembly. This will allow the .Net assembly to use the Microsoft GAC instead of the Mono GAC.
(comments are locked)
|
|
I had to work around this error by removing all use of XElement. Basicly I stopped using System.Xml.Linq and recoded my serializer to make use of System.Xml exclusively. Unfortunately this is just a poor work around rather than a proper fix.
(comments are locked)
|
|
Based on the code snippets I see either you are using C# and using its var command (which would work for certain things, but it shouldn't be used here) or you are using another language all together. Anyways if this is indeed C# change your var to XDocument. var should only be used when you don't know for sure what type of variable is going to be sent to a function or class. If you are using var throughout your code you are slowing down your code and increasing the time it takes to compile your code along with bringing possible unnecessary bugs to your game. If what I said is indeed what you are doing I would recommend reading up on C# and learning proper syntax for C#. All of your variables should either use int, float, double, bool, char, string, enum, or the name of a class. var should only be used when absolutely necessary. I hope this helps with your problem. No, var is implicitly typed by the compiler: http://msdn.microsoft.com/en-us/library/bb383973.aspx Also remarks like these should be added as a comment rather as an answer as it is off topic.
Apr 08 '11 at 06:11 AM
Woutor
(comments are locked)
|

Im not an expert at C Sharp, however it would help contributers a lot if you had some source code in your question
good suggestion