Ces.Shared
1.0.0
dotnet add package Ces.Shared --version 1.0.0
NuGet\Install-Package Ces.Shared -Version 1.0.0
<PackageReference Include="Ces.Shared" Version="1.0.0" />
<PackageVersion Include="Ces.Shared" Version="1.0.0" />
<PackageReference Include="Ces.Shared" />
paket add Ces.Shared --version 1.0.0
#r "nuget: Ces.Shared, 1.0.0"
#:package Ces.Shared@1.0.0
#addin nuget:?package=Ces.Shared&version=1.0.0
#tool nuget:?package=Ces.Shared&version=1.0.0
CES.Shared Documentation
Overview
Ces.Shared is a lightweight state-sharing and binding system for .NET applications.
It allows objects to synchronize properties dynamically using string-based keys and shared states.
The package provides:
- Dynamic property storage
- State synchronization
- Reactive bindings
- Shared object management
- Automatic property update notifications
Namespace
Ces.Shared
Classes
CesObjectState
Represents a shared state object that stores dynamic properties.
Implements:
INotifyPropertyChanged
Features
- Dynamic property dictionary
- Typed value retrieval
- Property change notifications
- Shared reactive updates
Properties
Id
Unique identifier of the state object.
public string Id { get; init; }
Properties
Internal dictionary containing all stored values.
public Dictionary<string, object> Properties { get; }
Events
SetChanged
Triggered whenever a value is updated.
event Action<string, object>
Parameters:
| Parameter | Description |
|---|---|
| key | Property name |
| value | New value |
GetChanged
Triggered when a value is retrieved using Get<T>().
event Action
PropertyChanged
Standard .NET property change notification event.
event PropertyChangedEventHandler
Methods
Set
Stores or updates a value.
void Set(string key, object value)
Example:
state.Set("Health", 100);
Get<T>
Gets a value from the state.
T Get<T>(string key)
Example:
int health = state.Get<int>("Health");
GetOrDefault<T>
Gets a value or returns a default value if the key does not exist.
T GetOrDefault<T>(string key, T defaultValue = default!)
Example:
int hp = state.GetOrDefault("HP", 0);
TryGet<T>
Safely tries to retrieve a value.
bool TryGet<T>(string key, out T value)
Example:
if(state.TryGet<int>("Coins", out var coins))
{
Console.WriteLine(coins);
}
CesBindable
Abstract class used to bind local properties to a shared state.
Features
- Dynamic property binding
- Automatic synchronization
- State reallocation
- Reactive updates
Protected Methods
Bind<T>
Creates a binding between a property and a shared state key.
protected void Bind<T>(
string key,
Func<T> getter,
Action<T> setter
)
Example:
Bind(
"Health",
() => Health,
value => Health = value
);
Public Methods
Attach
Attaches the object to a CesObjectState.
void Attach(CesObjectState state)
This enables:
- automatic updates
- synchronization
- reactive bindings
Apply
Applies all bindings manually.
void Apply(CesObjectState state)
Reallocate
Rewrites current values back into the shared state.
void Reallocate(CesObjectState state)
CesShared
Main container for all shared objects and global values.
Properties
Objects
Stores all created shared objects.
Dictionary<string, CesObjectState>
Globals
Stores global shared values.
Dictionary<string, object>
Methods
Create
Creates a new shared object state.
CesObjectState Create(string id)
Example:
var player = shared.Create("player");
Get
Gets an existing shared object by id.
CesObjectState Get(string id)
Example:
var player = shared.Get("player");
Full Example
using Ces.Shared;
public class Player : CesBindable
{
public int Health { get; set; }
public Player()
{
Bind(
"Health",
() => Health,
value => Health = value
);
}
}
var shared = new CesShared();
var state = shared.Create("player");
var player = new Player();
player.Attach(state);
state.Set("Health", 150);
Console.WriteLine(player.Health);
Use Cases
Ces.Shared can be used for:
- Game entity synchronization
- UI binding systems
- Shared application state
- Multiplayer replication prototypes
- Dynamic runtime properties
- Plugin communication
- Reactive architectures
Advantages
- Lightweight
- Dynamic
- Easy integration
- Reactive event system
- Minimal dependencies
- Generic typed access
- Runtime extensibility
Package Structure
Ces.Shared
├── CesObjectState
├── CesBindable
└── CesShared
License
MIT License.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net9.0-windows10.0.19041 is compatible. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net9.0
- No dependencies.
-
net9.0-windows10.0.19041
- No dependencies.
NuGet packages (1)
Showing the top 1 NuGet packages that depend on Ces.Shared:
| Package | Downloads |
|---|---|
|
Ces.Core
O CES (CSharp Easy Script) é uma linguagem de script .NET simples e extensível para jogos, simulações, automação e aplicações de uso geral. |
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 148 | 5/23/2026 |