c#equals方法源码
Int32.Equals()方法 (Int32.Equals() Method)
This method is used to compare two integer objects and returns boolean values either true or false.
此方法用于比较两个整数对象,并返回布尔值true或false。
Syntax:
句法:
bool int.equals(int objA, int objB);
Parameter(s):
参数:
int objA, int objB – are used to represent two integer objects to be compared.
int objA,int objB –用于表示要比较的两个整数对象。
Return value:
返回值:
bool – it returns "true" if both objects are equal, else it returns "false".
bool-如果两个对象相等,则返回“ true”,否则返回“ false”。
C#中的Int32.Equals()方法示例 (Int32.Equals() Method Example in C#)
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
int a = 0;
int b = 0;
Console.Write("Enter A: ");
a = Convert.ToInt32(Console.ReadLine());
Console.Write("Enter B: ");
b = Convert.ToInt32(Console.ReadLine());
if (int.Equals(a, b) == true)
{
Console.WriteLine("Both are equal");
}
else
{
Console.WriteLine("Both are not equal");
}
}
}
}
Output
输出量
Enter A: 10
Enter B: 15
Both are not equal
Enter A: 10
Enter B: 10
Both are equal
翻译自: https://www.includehelp.com/dot-net/int32-equals-method-with-example-in-csharp.aspx
c#equals方法源码