Guest User

Untitled

a guest
Aug 10th, 2018
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. factory create method in C#?
  2. class TwsCom {
  3.  
  4. private ApiComObject apiComObject;
  5.  
  6. public TwsCom() {
  7. apiComObject = new ApiComObject(); // create an instance, if required
  8. }
  9. // you might want to keep this variable type private to avoid breaking
  10. // the rules
  11. private ActiveXType NewActiveXType() {
  12. return apiComObject.Create();
  13. }
  14.  
  15. public object SomeMethod() {
  16. ActiveXType activeX = NewActiveXType();
  17. return activeX.SomeMethod();
  18. }
  19.  
  20. }
Add Comment
Please, Sign In to add comment