I have a class Category with two a property name as string.
and have a other class that use this class.
Public Class Myclass
{
public virtual Category Category
{
get;
set;
}
}
I have a object of Myclass. I want set string value for Category Property of this object .
Myclass cls=new Myclass();
cls.Category=// a string value
How to set this ?
Categoryis of a type also calledCategory. But we don't know what thisCategoryis? Is it a class or an enum, perhaps? We need to know that. Why do you think astringtype should convert toCategorytype? SinceSystem.Stringdoes not derive from (or implement) anything calledCategory, you will need an implicit conversion operator for it to work. Or simply call some method explicitly which converts yourstringintoCategory.