What is the usage of these operators?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Basically when you want to provide conversions between types. LINQ to XML provides good examples… There’s an implicit conversion from string to XName, so you can write:
but there’s an explicit conversion from
XAttributetoint(and many other types) so you have to include a cast in your code:Think very carefully before providing implicit conversions – they’re rarely a good idea; LINQ to XML uses them to great effect, but they can be confusing. Even explicit user-defined conversions can surprise the unwary reader.