引用中添加了"System"。
但其实这个函数是micorlib.dll中的system的,而引用中无法添加这个文件,此项目系统自动引用。
查看此文件,确实没有这个Compare函数。但是另一台机子中也没有这个函数,但能正常运行。。。。。。
很奇怪,原来没问题,突然产生了这个问题。
求指教
7 个解决方案
#1
mscorlib,打错了
#2
多个版本的.net framework......
#3
问题是早上9点能用的,后来我修改了下程序,就不能用了。不知道是哪里改动了。。。。。悲催
#4
自己顶起啊
#5
卸掉你新安装的软件,试试看~我以前也遇到过
#6
竟然真的是这样的。。。。
#7
有这两个
//
// Summary:
// Compares two specified System.String objects using the specified comparison
// options and culture-specific information to influence the comparison, and
// returns an integer that indicates the relationship of the two strings to
// each other in the sort order.
//
// Parameters:
// strA:
// The first string.
//
// strB:
// The second string.
//
// culture:
// The culture that supplies culture-specific comparison information.
//
// options:
// Options to use when performing the comparison (such as ignoring case or symbols).
//
// Returns:
// A 32-bit signed integer that indicates the lexical relationship between strA
// and strB, as shown in the following table Value Condition Less than zero
// strA is less than strB. Zero strA equals strB. Greater than zero strA is
// greater than strB.
//
// Exceptions:
// System.ArgumentException:
// options is not a System.Globalization.CompareOptions value.
//
// System.ArgumentNullException:
// culture is null.
public static int Compare(string strA, string strB, CultureInfo culture, CompareOptions options);
//
// Summary:
// Compares substrings of two specified System.String objects using the specified
// comparison options and culture-specific information to influence the comparison,
// and returns an integer that indicates the relationship of the two substrings
// to each other in the sort order.
//
// Parameters:
// strA:
// The first string.
//
// indexA:
// The starting position of the substring within strA.
//
// strB:
// The second string.
//
// indexB:
// The starting position of the substring within strB.
//
// length:
// The maximum number of characters in the substrings to compare.
//
// culture:
// The culture that supplies culture-specific comparison information.
//
// options:
// Options to use when performing the comparison (such as ignoring case or symbols).
//
// Returns:
// An integer that indicates the lexical relationship between the two substrings,
// as shown in the following table. Value Condition Less than zero The substring
// in strA is less than the substring in strB. Zero The substrings are equal
// or length is zero. Greater than zero The substring in strA is greater than
// the substring in strB.
//
// Exceptions:
// System.ArgumentException:
// options is not a System.Globalization.CompareOptions value.
//
// System.ArgumentOutOfRangeException:
// indexA is greater than strA.Length. -or- indexB is greater than strB.Length.
// -or- indexA, indexB, or length is negative. -or- Either strA or strB is
// null, and length is greater than zero.
//
// System.ArgumentNullException:
// culture is null.
public static int Compare(string strA, int indexA, string strB, int indexB, int length, CultureInfo culture, CompareOptions options);
#1
mscorlib,打错了
#2
多个版本的.net framework......
#3
问题是早上9点能用的,后来我修改了下程序,就不能用了。不知道是哪里改动了。。。。。悲催
#4
自己顶起啊
#5
卸掉你新安装的软件,试试看~我以前也遇到过
#6
竟然真的是这样的。。。。
#7
有这两个
//
// Summary:
// Compares two specified System.String objects using the specified comparison
// options and culture-specific information to influence the comparison, and
// returns an integer that indicates the relationship of the two strings to
// each other in the sort order.
//
// Parameters:
// strA:
// The first string.
//
// strB:
// The second string.
//
// culture:
// The culture that supplies culture-specific comparison information.
//
// options:
// Options to use when performing the comparison (such as ignoring case or symbols).
//
// Returns:
// A 32-bit signed integer that indicates the lexical relationship between strA
// and strB, as shown in the following table Value Condition Less than zero
// strA is less than strB. Zero strA equals strB. Greater than zero strA is
// greater than strB.
//
// Exceptions:
// System.ArgumentException:
// options is not a System.Globalization.CompareOptions value.
//
// System.ArgumentNullException:
// culture is null.
public static int Compare(string strA, string strB, CultureInfo culture, CompareOptions options);
//
// Summary:
// Compares substrings of two specified System.String objects using the specified
// comparison options and culture-specific information to influence the comparison,
// and returns an integer that indicates the relationship of the two substrings
// to each other in the sort order.
//
// Parameters:
// strA:
// The first string.
//
// indexA:
// The starting position of the substring within strA.
//
// strB:
// The second string.
//
// indexB:
// The starting position of the substring within strB.
//
// length:
// The maximum number of characters in the substrings to compare.
//
// culture:
// The culture that supplies culture-specific comparison information.
//
// options:
// Options to use when performing the comparison (such as ignoring case or symbols).
//
// Returns:
// An integer that indicates the lexical relationship between the two substrings,
// as shown in the following table. Value Condition Less than zero The substring
// in strA is less than the substring in strB. Zero The substrings are equal
// or length is zero. Greater than zero The substring in strA is greater than
// the substring in strB.
//
// Exceptions:
// System.ArgumentException:
// options is not a System.Globalization.CompareOptions value.
//
// System.ArgumentOutOfRangeException:
// indexA is greater than strA.Length. -or- indexB is greater than strB.Length.
// -or- indexA, indexB, or length is negative. -or- Either strA or strB is
// null, and length is greater than zero.
//
// System.ArgumentNullException:
// culture is null.
public static int Compare(string strA, int indexA, string strB, int indexB, int length, CultureInfo culture, CompareOptions options);