c# - Setting variable 'as type' -
came across snippet of code today:
eventfeed feed = null; feed = service.query(eventquery) eventfeed; why as eventfeed @ end? return type of function eventfeed, i'm struggling see benefit of such statement.
i found difficult search problem i'm asking on here. advantages writing line this?
feed might declared eventfeed result of service.query(eventquery) may not be.
using as stops exception being thrown , end null instead if result of expression cannot cast eventfeed.
you can read more as here - http://msdn.microsoft.com/en-us/library/cscsdfbt(v=vs.71).aspx
Comments
Post a Comment