Guest User

Untitled

a guest
Jan 16th, 2019
98
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. interface ISecuredItem<TChildType> where TChildType : class, ISecuredItem<TChildType>
  2. {
  3. SecurityDescriptor Descriptor { get; }
  4. IEnumerable<TChildType> Children { get; }
  5. }
  6.  
  7. class RegistryKey : ISecuredItem<RegistryKey>
  8. {
  9. public SecurityDescriptor Descriptor { get; private set; }
  10. public IEnumerable<RegistryKey> Children { get; }
  11. }
  12.  
  13. public interface ISecuredItem<TChildType>
  14. where TChildType : ISecuredItem<TChildType>
  15. {
  16. SecurityDescriptor Descriptor { get; }
  17. IEnumerable<TChildType> Children { get; }
  18. }
  19.  
  20. public interface StubImplemtation : ISecuredItem<StubImplemtation> { }
  21.  
  22. var securedItemStub = new StubISecuredItem<StubImplemtation>
  23. {
  24. ChildrenGet = () => new List<StubImplemtation>(),
  25. DescriptorGet = () => new SecurityDescriptor()
  26. };
  27.  
  28. var children = securedItemStub.ChildrenGet();
  29. var descriptor = securedItemStub.DescriptorGet();
Add Comment
Please, Sign In to add comment