12345678910111213141516171819202122232425262728293031323334353637383940414243 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace SmartCoalApplication.Base
- {
- public abstract class Resource<T>
- {
- protected T resource;
- public T Reference
- {
- get
- {
- if (this.resource == null)
- {
- this.resource = Load();
- }
- return this.resource;
- }
- }
- public T GetCopy()
- {
- return Load();
- }
- protected abstract T Load();
- protected Resource()
- {
- this.resource = default(T);
- }
- protected Resource(T resource)
- {
- this.resource = resource;
- }
- }
- }
|