Пример #1
0
    public object Clone()
    {
        // We only do a shallow copy of RecordedSpeciesInfo here as SpeciesInfo objects are never modified.
        var result = new PatchSnapshot
        {
            TimePeriod          = TimePeriod,
            SpeciesInPatch      = new Dictionary <Species, long>(SpeciesInPatch),
            RecordedSpeciesInfo = new Dictionary <Species, SpeciesInfo>(RecordedSpeciesInfo),
            Biome = (BiomeConditions)Biome.Clone(),
        };

        return(result);
    }
Пример #2
0
    public object Clone()
    {
        var result = new PatchSnapshot
        {
            TimePeriod     = TimePeriod,
            SpeciesInPatch = new Dictionary <Species, long>(SpeciesInPatch.Count),
            Biome          = (BiomeConditions)Biome.Clone(),
        };

        foreach (var entry in SpeciesInPatch)
        {
            result.SpeciesInPatch.Add(entry.Key, entry.Value);
        }

        return(result);
    }