c# - detecting type of generics within generics -


i have method accepts many different types of objects storage:

public void store<t>(t item) {     // works fine     if (item foo)     {       // ...     }     // works fine     else if (item observation<imagesignal>)     {       // ...     }      // isn't detected     else if (item observation<signal<ispectrum>>)     {       // ...     }      else      {       // observation<signal<ispectrum>> hits this.       throw new notsupportedexception();     } } 

can tell me how can detect this?

edit: passing in object wraps object. eric right. problem solved. quick responses, however.

in case wouldn't better overload store function? easier follow logic.

public void store(foo item) { }  public void store(observation<imagesignal> item) { }  public void store(observation<signal<ispectrum>> item) { } 

Comments

Popular posts from this blog

java - Play! framework 2.0: How to display multiple image? -

gmail - Is there any documentation for read-only access to the Google Contacts API? -

php - Controller/JToolBar not working in Joomla 2.5 -