C#で拡張メソッドを追加するためにmsxslを使用しているXSL変換があります。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" />
次に、拡張メソッドとしてac#関数を使用します。
public int returnUniqueCount(string theCodeCollection) {
// calculate and return the total number of distinct codes
if (theCodeCollection.Length > 0) {
string[] myObject = theCodeCollection.Split('|');
string[] uniqueCollection = myObject.Distinct().ToArray();
return uniqueCollection.Length;
} else {
return 0;
}
}
基本的には、トークン化された文字列を取得して分割し、重複を除いて結果セットをカウントします。
変換はサーバー上で正常に実行されますが、プロファイルしようとすると、次のエラーが発生します。
'System.Array' does not contain a definition for 'Distinct'
私は今朝ずっと頭を打ちつけてきました、そして私はそれを見ていません。何か案は?
皆さんありがとう。