I have an XSL transform that uses msxsl to add extension methods in C #. I have the following setting for msxsl:
<msxsl:script language="C#" implements-prefix="cs">
<msxsl:assembly name="System.Core, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<msxsl:assembly name="System.Xml.Linq, Version=3.5.0.0, Culture=neutral, PublicKeyToken=B77A5C561934E089" />
<msxsl:using namespace="System.Collections.Generic" />
<msxsl:using namespace="System.Linq" />
<msxsl:using namespace="System.Xml.Linq" />
Then I have a C # function as an extension method:
public int returnUniqueCount(string theCodeCollection) {
if (theCodeCollection.Length > 0) {
string[] myObject = theCodeCollection.Split('|');
string[] uniqueCollection = myObject.Distinct().ToArray();
return uniqueCollection.Length;
} else {
return 0;
}
}
Essentially, it just takes a tokenized string, splits it, and counts the result, eliminating duplicates.
The conversion works fine on the server, but when I try to profile it, I get the following error:
'System.Array' does not contain a definition for 'Distinct'
I hit my head about it all the time, and I just don't see it. Any ideas?
Thanks to everyone.
source
share