Emanuel Amiguinho
Emanuel Amiguinho

Reputation: 123

Metro App global variables C#

Im creating my first app for Windows 8 and i have a question. In Windows Phone 7 we can define in App.xaml.cs all global variables and access by App.all_performers for exemple, this works fine with default data types but if i create a List of one object created by me like evento

public static List<evento> eventos_near = new List<evento>(); 

i have this error:

Inconsistent accessibility: field type 'System.Collections.Generic.List<UrbaneousTry2.evento>' is less accessible than field 'UrbaneousTry2.App.eventos_near'

Anyone can help me? i need Lists and Dictionaries to use in all pages of my app

Upvotes: 3

Views: 3870

Answers (2)

Sofian Hnaide
Sofian Hnaide

Reputation: 2364

You have to make your class eventos public.

Upvotes: 1

JaredPar
JaredPar

Reputation: 755141

The problem you are hitting is that evento isn't a public type yet you've declared it as available in a public location. If this were legal it would allow a type declared to be not public be accessible from any referencing assembly which effectively makes it public.

You need to either switch evento to be a public type or make the declaration internal

internal static List<evento> eventos_near = new List<evento>(); 

Upvotes: 6

Related Questions