Coder Social home page Coder Social logo

valueobject's People

Contributors

jhewlett avatar mbican avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

valueobject's Issues

Improve comparisons floating-point numeric types

Hello!

Improve comparisons floating-point numeric types. For example:

bool IsEqualsFloat(float x, float y) =>
    Math.Abs(x - y) < 1e-7;

bool IsEqualsDouble(double x, double y) =>
    Math.Abs(x - y) < 1e-15;

SonarQube warning: Classes implementing "IEquatable<T>" should be sealed

Hi,

SonarQube is giving out the warning with the following explanation:

When a class implements the IEquatable interface, it enters a contract that states, "I know how to compare two instances of type T or any type derived from T for equality.". However, if that class is derived, it is improbable that the base class will know how to make a meaningful comparison. Therefore that implicit contract is now broken.

Alternatively, IEqualityComparer provides a safer interface and is used by collections or Equals could be made virtual.

This rule raises an issue when an unsealed, public, or protected class implements IEquitable and the Equals are neither virtual nor abstract

I am looking forward to hearing your thoughts on it.

Thanks

problems with Interface implementation

bellow doesnt work(test fails) but it shuld imho.
`
using NUnit.Framework;
using Value;

namespace ValueObjectTests
{
[TestFixture]
public class ValueObjectTests
{
[Test]
public void EqualityTests()
{
IMyValueObject a = new MyValueObject();
IMyValueObject b = new MyValueObject();

        var actual = a == b;
        var expected = true;

        Assert.AreEqual(expected, actual);
    }
}

public interface IMyValueObject
{
    string Val { get; }
}

public class MyValueObject : ValueObject, IMyValueObject
{
    public string Val { get; } = "xxx";
}

}`

can you add [Serializable] attribute

我使用了微软的Orleans,默认需要在类加上 [Serializable] 的attribute ,
但是如果我的类继承了: Value.ValueObject,就报错 Value.ValueObject 没有添加 [Serializable] 的attribute

I use Microsoft's Orleans. By default, I need to add [Serializable] attribute to the class.
But if my class inherits: Value.ValueObject, it is wrong that Value.ValueObject did not add the attribute of [Serializable].

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.