Answer the question
In order to leave comments, you need to log in
How to rewrite this code in C#?
Hello everyone, help me rewrite this code (Java language) into C#
@Override
public int hashCode() {
return Objects.hash(
getGitCommitId(),
getGitCommitIdDescribeShort(),
getBuildTimeStamp(),
getProjectVersion(),
getCopyright(),
getLicense(),
getUrl(),
getBuildJDKVersion(),
getTargetJREVersion());
}
public override int GetHashCode()
{
return base.GetHashCode(
GetGitCommitId(),
GetGitCommitIdDescribeShort(),
GetBuildTimeStamp(),
GetProjectVersion(),
GetCopyright(),
GetLicense(),
GetUrl(),
GetBuildJDKVersion(),
GetTargetJREVersion());
}
Answer the question
In order to leave comments, you need to log in
Use the Add method from the HashCode structure :
public override int GetHashCode()
{
var hashCode = new HashCode();
hashCode.Add(GetGitCommitId());
hashCode.Add(GetGitCommitIdDescribeShort());
hashCode.Add(GetBuildTimeStamp());
hashCode.Add(GetProjectVersion());
hashCode.Add(GetCopyright());
hashCode.Add(GetLicense());
hashCode.Add(GetUrl());
hashCode.Add(GetBuildJDKVersion());
hashCode.Add(GetTargetJREVersion());
return hashCode.ToHashCode();
}
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question