Common causes of it:
1. you might not have added the required using directive
2. you might have forgotten to reference (-reference) the assembly that contains the type
3. there might be an issue with the assembly you are trying to reference
Look at them one by one and you should be able to zero down on its cause.
Other possible reasons:
1. Did you use a variable or some other language element where a type was expected?
2. Did you reference the assembly that was built against a higher framework version than the target framework of the program?
3. Did you use a using alias directive without fully qualifying the type name?
4. If you get this error in code that was previously working, first look for missing or unresolved references in Solution Explorer. Like - do you need to reinstall a NuGet package?
Reference: Compiler Error CS0246 | Microsoft Docs