Is using "as" in C# a safe way of casting?

Viewed 22820

I am wondering if using the keyword "as" in the following code is a safe way (i.e. won't blow up) of casting in C#:

public void abc(ref Object dataSource)
{
    DataTable table = dataSource as DataTable;
}

Is there a safer way of casting?

11 Answers
Related