You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
27 lines
567 B
27 lines
567 B
using Flyweight.Objects;
|
|
using Newtonsoft.Json;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace Flyweight.Flyweights
|
|
{
|
|
internal class Flyweight
|
|
{
|
|
private Car _sharedState;
|
|
|
|
public Flyweight(Car car)
|
|
{
|
|
_sharedState = car;
|
|
}
|
|
|
|
public void Operation(Car uniqueState)
|
|
{
|
|
string s = JsonConvert.SerializeObject(_sharedState);
|
|
string u = JsonConvert.SerializeObject(uniqueState);
|
|
Console.WriteLine($"Flyweight: Displaying shared {s} and unique {u} state.");
|
|
}
|
|
}
|
|
}
|
|
|