0
public partial class CityDetailPage : System.Web.UI.Page
{
 protected List<CityPhotoGallery> cityPhotoGallery;--It is allowed
 protected var cityPhotoGallery; --IT IS NOT ALLOWED

 protected void Page_Load(object sender, EventArgs e)
 {

 }

}

I know how to pass normal variable(whose data Types are known) from aspx.cs page to .aspx page, but in my current senerio a have a var type variable so how i pass this variable to .aspx page from .aspx.cs page

Vishwajeet
  • 1,575
  • 2
  • 19
  • 35

1 Answers1

0

There is no such thing as a var type.

The datatype is either anonymous, e.g. when you use a projection in linq-2-sql or it is the actual datatype derived by the compiler. In that case using var is just shorter.

update You cannot pass an anonymous type. You just need to use the definite type. If you want to pass around a projection, you need to create a specific type for that. They are called Poco or DTO (data transfer) object. They function as simple data containers and are used for moving data between the layers of an application

For more information POCO vs DTO

Community
  • 1
  • 1
Pleun
  • 8,856
  • 2
  • 30
  • 50