K
kilik3000
Hi All,
I have a question about who one should go about casting types in C#.
I have heard some writers and speakers call static casting a bad
practice and recommend using "as" and "is". That's fine.
However in most of the production code that I see, programmers use
either static casting OR use the "as" keyword without using the "is"
keyword first to verify that the object actually supports the desired
type.
What gives?
Is this just laziness or is something gained in brevity by only using
the static cast or the "as" keyword.
-Thx
I have a question about who one should go about casting types in C#.
I have heard some writers and speakers call static casting a bad
practice and recommend using "as" and "is". That's fine.
However in most of the production code that I see, programmers use
either static casting OR use the "as" keyword without using the "is"
keyword first to verify that the object actually supports the desired
type.
What gives?
Is this just laziness or is something gained in brevity by only using
the static cast or the "as" keyword.
-Thx