От: | _nn_ | www.nemerleweb.com | |
Дата: | 28.03.10 14:23 | ||
Оценка: |
S> public static GetDataString(categoryId : string) : string
S> {
S> if (categoryId!="")
S> { def res = linq<#from i in _CfgIzmeritel
S> from c in _CfgTypeIzmer
S> where i.ID_Izmerit==int.Parse(categoryId)
S> where c.ID_TypeIzmerit == i.ID_TypeIzmerit
S> select (c.CaptionForTables)#> ; res.ToArray()[0]
S> } else ""
S> }
S>
using Nemerle.Collections;
using Nemerle.Text;
using Nemerle.Utility;
using Nemerle.Data.Linq;
using System;
using System.Collections.Generic;
using System.Console;
using System.Linq;
[Record]
class CfgIzmeritel
{
[Accessor]
_ID_Izmerit : int;
[Accessor]
_ID_TypeIzmerit : int;
}
[Record]
class CfgTypeIzmer
{
[Accessor]
_ID_TypeIzmerit: int;
[Accessor]
_CaptionForTables : string;
}
module Program
{
public static GetDataString(categoryId : string) : string
{
def _CfgIzmeritel = array[CfgIzmeritel(1, 2), CfgIzmeritel(1, 2)];
def _CfgTypeIzmer = array[CfgTypeIzmer(2, "a"), CfgTypeIzmer(2, "a")];
if (categoryId!="")
{
def res =
linq<#
from i in _CfgIzmeritel
from c in _CfgTypeIzmer
where i.ID_Izmerit == int.Parse(categoryId)
where c.ID_TypeIzmerit == i.ID_TypeIzmerit
select (c.CaptionForTables)#> ;
res.ToArray()[0]
}
else
""
}
public Main() : void
{
}
}
Error: each overload has an error during call:
Error: overload #1, "method System.Linq.Enumerable.Where(source : System.Collections.Generic.IEnumerable[TSource], predicate : System.Func[TSource, int, bool]) : System.Collections.Generic.IEnumerable[TSource]" fail because:
Error: in argument #2 (predicate), needed a System.Func[(CfgIzmeritel- * CfgTypeIzmer-)-, int, bool], got (? * ?) -> bool-: ((CfgIzmeritel- * CfgTypeIzmer-)- * int) -> bool is not a subtype of System.Func[(CfgIzmeritel- * CfgTypeIzmer-)-, int, bool] [simple require]
Error: overload #2, "method System.Linq.Enumerable.Where(source : System.Collections.Generic.IEnumerable[TSource], predicate : System.Func[TSource, bool]) : System.Collections.Generic.IEnumerable[TSource]" fail because:
Error: in argument #2 (predicate), needed a System.Func[(CfgIzmeritel- * CfgTypeIzmer-)-, bool], got (? * ?) -> bool-: (CfgIzmeritel- * CfgTypeIzmer-) -> bool is not a subtype of System.Func[(CfgIzmeritel- * CfgTypeIzmer-), bool] [simple require]