You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: README.md
+17Lines changed: 17 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -127,6 +127,23 @@ private void InvokeEvent()
127
127
}
128
128
```
129
129
130
+
### Exposing
131
+
132
+
Now that you've set up your Safe Event you most likely want to be able to use it from a different place.
133
+
134
+
The recommended way of doing this is by exposing an event property as shown below, instead of directly exposing the Safe Event
135
+
136
+
```c#
137
+
privateSafeEvent<int>onFooEvent;
138
+
139
+
publiceventAction<int>OnFooEvent
140
+
{
141
+
add=>onFooEvent.Subscribe(value);
142
+
remove=>onFooEvent.Unsubscribe(value);
143
+
}
144
+
```
145
+
146
+
The benefit of this is that to the outside it looks and behaves like a normal event even though under the hood it has the benefits of the Safe Event.
130
147
131
148
## Support
132
149
**Safe Event** is a small and open-source utility that I hope helps other people. It is by no means necessary but if you feel generous you can support me by donating.
0 commit comments