Abdul Basit
Abdul Basit

Reputation: 722

Serialization of Generic Classes

I have a class named "City"

public class City
{
   public int ID {get; set;}
   public int StateID {get; set;}
   public int CountryID{get; set;}
   public string Name{get; set;}
   .......

}

and i have an asp.net page named CityAdd.aspx, in this page i want to create a collection of city class that can be store in the viewstate. Is it possible to make a Generic Collection Serializable?

Upvotes: 0

Views: 66

Answers (1)

Damith
Damith

Reputation: 63065

do as below, add Serializable attribute

[Serializable] 
public class City
{
}

Upvotes: 1

Related Questions