Warning: file_get_contents(/data/phpspider/zhask/data//catemap/0/unity3d/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 创建Unity 3D的分隔字符串扩展名_C#_Unity3d - Fatal编程技术网

C# 创建Unity 3D的分隔字符串扩展名

C# 创建Unity 3D的分隔字符串扩展名,c#,unity3d,C#,Unity3d,在这个问题上,一个家伙提出了一个适用于IEnumerable的出色的ToDelimiteString扩展方法: 我正试图在Unity 3D 4.0中使用它,因为系统名称空间被覆盖,这会导致问题,到目前为止,我已经进行了绝对引用: public static string ToDelimitedString<T> (this IEnumerable<T> source) { return source.ToDelimitedString (x =>

在这个问题上,一个家伙提出了一个适用于IEnumerable的出色的ToDelimiteString扩展方法:

我正试图在Unity 3D 4.0中使用它,因为系统名称空间被覆盖,这会导致问题,到目前为止,我已经进行了绝对引用:

    public static string ToDelimitedString<T> (this IEnumerable<T> source) {
    return source.ToDelimitedString (x => x.ToString (),
    System.Globalization.CultureInfo.CurrentCulture.TextInfo.ListSeparator);
    }

    public static string ToDelimitedString<T> (this IEnumerable<T> source, System.Func<T, string> converter) {
    return source.ToDelimitedString (converter,
    System.Globalization.CultureInfo.CurrentCulture.TextInfo.ListSeparator);
    }

    public static string ToDelimitedString<T> (this IEnumerable<T> source, string separator) {
    return source.ToDelimitedString (x => x.ToString (), separator);
    }

    public static string ToDelimitedString<T> (this IEnumerable<T> source, System.Func<T, string> converter, string separator) {
    return string.Join (separator, source.Select (converter).ToArray ());
    }
用于删除字符串的公共静态字符串(此IEnumerable源代码){
返回source.ToDelimitedString(x=>x.ToString(),
System.Globalization.CultureInfo.CurrentCulture.TextInfo.ListSeparator);
}
公共静态字符串ToDelimitedString(此IEnumerable源,System.Func转换器){
返回source.ToDelimiteString(转换器,
System.Globalization.CultureInfo.CurrentCulture.TextInfo.ListSeparator);
}
公共静态字符串ToDelimitedString(此IEnumerable源,字符串分隔符){
返回source.ToDelimitedString(x=>x.ToString(),分隔符);
}
公共静态字符串ToDelimitedString(此IEnumerable源、System.Func转换器、字符串分隔符){
返回string.Join(分隔符,source.Select(converter.ToArray());
}
我正试图在Unity 3d中实现这一点,但我的错误是:

Assets/Main/Extensions.cs(125,55):错误CS1061:Type
System.Collections.Generic.IEnumerable'不包含
Select'的定义,并且找不到类型为System.Collections.Generic.IEnumerable'的扩展方法(是否缺少using指令或程序集引用?)


注意,我已经改变了一些,我无法克服的是“来源。选择”,我相信,这是可能的吗?谢谢,它使调试更容易,不必重写扩展,并且可能有助于序列化。

您似乎缺少Linq名称空间

你需要:

   using System.Linq;