What will happen if we provide string or decimal value other than integer value in Unit.Pixel method?

Button1.BorderWidth = Unit.Pixel(1.5M);
Button1.BorderWidth = Unit.Pixel("1");

 Posted by vishalneeraj-24503 on 6/5/2014 | Category: ASP.NET Interview questions | Views: 206 | Points: 40
Answer:

In this case,it will give us compile time error saying that:

cannot convert from 'decimal' to 'int' in case of passing decimal values

cannot convert from 'string' to 'int' in case of passing string values

So to avoid above exception,always pass numeric value in Unit.Pixel method.


Asked In: Many Interviews | Alert Moderator 

Comments or Responses

Login to post response