运行时报错:“找不到Int32 System.String.Compare。。。。。” 求指教

shadow_left 2011-09-22 01:31:22
运行时报错:“找不到Int32 System.String.Compare(System.String,System.String,System.Globalization.CultureInfo,System.Globalization.CompareOptions)”。
引用中添加了"System"。
但其实这个函数是micorlib.dll中的system的,而引用中无法添加这个文件,此项目系统自动引用。
查看此文件,确实没有这个Compare函数。但是另一台机子中也没有这个函数,但能正常运行。。。。。。
很奇怪,原来没问题,突然产生了这个问题。

求指教
...全文
313 7 打赏 收藏 转发到动态 举报
AI 作业
写回复
用AI写文章
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);
shadow_left 2011-09-22
  • 打赏
  • 举报
回复
竟然真的是这样的。。。。

[Quote=引用 5 楼 asthegarn 的回复:]

卸掉你新安装的软件,试试看~我以前也遇到过
[/Quote]
asthegarn 2011-09-22
  • 打赏
  • 举报
回复
卸掉你新安装的软件,试试看~我以前也遇到过
shadow_left 2011-09-22
  • 打赏
  • 举报
回复
自己顶起啊
shadow_left 2011-09-22
  • 打赏
  • 举报
回复
[Quote=引用 2 楼 qiume 的回复:]

多个版本的.net framework......
[/Quote]

问题是早上9点能用的,后来我修改了下程序,就不能用了。不知道是哪里改动了。。。。。悲催
qiume 2011-09-22
  • 打赏
  • 举报
回复
多个版本的.net framework......
shadow_left 2011-09-22
  • 打赏
  • 举报
回复
mscorlib,打错了

111,093

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • AIGC Browser
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧