Reflection in D

rumbu via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Fri Jan 27 23:39:51 PST 2017


On Saturday, 28 January 2017 at 07:10:27 UTC, medhi558 wrote:
> I have a last question, currently i use :
> if(lc.name.indexOf("protocol.messages") != -1)
>
> To know if the class is a NetworkMessage, Would be possible to 
> do this
>
> if(lc is NetworkMessage)
>
>
> Sorry for my English, i speak french.

if (auto nm = cast(NetworkMessage)lc)
{
   //do something with nm
}




More information about the Digitalmars-d-learn mailing list