Size: 546
Comment:
|
Size: 1493
Comment:
|
Deletions are marked like this. | Additions are marked like this. |
Line 11: | Line 11: |
=== Standard import === | == Custom Events & Handling == CustomEventArgs.cs |
Line 28: | Line 29: |
Instance.cs {{{#!highlight c# public delegate void NotifyCustomEvent(object sender, CustomEventArgs e); public event NotifyCustomEvent CustomEvent; private void RaiseCustomEvent(obj sender, obj item) { CustomEvent?.Invoke(sender, new CustomEventArgs(item)); } }}} InstanceOwner.cs {{{#!highlight c# public InsanceOwner() { Instance instance = new instance(); instance.CustomEvent += new Instance.NotifyCustomEvent(CustomEventHandler); } public void CustomEventHandler(obj sender, CustomEventArgs e) { //Handle that custom shit } }}} == Number Remap Class == {{{#!highlight c# public static class Remap { private static double Map(double value, double fromSource, double toSource, double fromTarget, double toTarget) { return (value - fromSource) / (toSource - fromSource) * (toTarget - fromTarget) + fromTarget; } } }}} |
Description
The snippets on this wikipage are written for the .NET Framework v4.0 and higher, but most probably work in older versions. Most will, however not work for .NET Core and .NET Standard.
Snippets
Custom Events & Handling
Instance.cs