public class ClientData : IEquatable<ClientData>
{
public String CustomerName { get; set; }
public int CustomerId { get; set; }
public bool Equals(ClientData other)
{
if (other == null) return false;
return (CustomerName == other.CustomerName && CustomerId == other.CustomerId);
}
public override int GetHashCode()
{
int hash = 23;
hash = hash * 31 + CustomerName.GetHashCode();
hash = hash * 31 + CustomerId.GetHashCode();
return hash;
}
}
and
public class Service
{
....
}
I'm looking for a way to use my ClientData but only within my service class i.e only the service class knows that the clientdata class exists and can use its methods normally
You can make it a nested class e.g.:
public class Service
{
private class ClientData : IEquatable<ClientData>
{
...
}
}
Make CientData a private nested class of Service:
public class Service
{
private class ClientData
{
// ...
}
}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With