« Compare » : différence entre les versions
De Banane Atomic
Aller à la navigationAller à la recherche
(Page créée avec « Category:CSharp = [https://github.com/GregFinzer/Compare-Net-Objects/wiki/Getting-Started Compare-Net-Objects] = <kode lang='cs'> var compareLogic = new CompareLogic()... ») |
Aucun résumé des modifications |
||
Ligne 2 : | Ligne 2 : | ||
= [https://github.com/GregFinzer/Compare-Net-Objects/wiki/Getting-Started Compare-Net-Objects] = | = [https://github.com/GregFinzer/Compare-Net-Objects/wiki/Getting-Started Compare-Net-Objects] = | ||
<kode lang='cs'> | <kode lang='cs'> | ||
var | var config = new ComparisonConfig(); | ||
config.IgnoreProperty<MyClass>(x => x.Id); | |||
ComparisonResult result = compareLogic.Compare( | var compareLogic = new CompareLogic(config); | ||
ComparisonResult result = compareLogic.Compare(object1, object2); | |||
if (!result.AreEqual) | if (!result.AreEqual) | ||
{ | |||
Console.WriteLine(result.DifferencesString); | Console.WriteLine(result.DifferencesString); | ||
} | |||
</kode> | </kode> |
Dernière version du 24 mars 2020 à 15:27
Compare-Net-Objects
var config = new ComparisonConfig(); config.IgnoreProperty<MyClass>(x => x.Id); var compareLogic = new CompareLogic(config); ComparisonResult result = compareLogic.Compare(object1, object2); if (!result.AreEqual) { Console.WriteLine(result.DifferencesString); } |