Praburaj
Praburaj

Reputation: 609

Initialization of Uri type

I am trying to initialize array of Uri.

Can anyone tell me how to initialize array of type Uri in c#?

I have tried initializing like string but it shows some error.

Upvotes: 0

Views: 3601

Answers (2)

A.K.
A.K.

Reputation: 3331

If you are looking for an array then

Uri UriArray=new Uri[]{new Uri("/MainPage.xaml",UriKind.RelativeOrAbsolute)};

else, You Can use List

List<Uri> uriList=new List<Uri>();
uriList.Add(new Uri("/MainPage.xaml",UriKind.RelativeOrAbsolute));

Upvotes: 0

Jaihind
Jaihind

Reputation: 2778

List is another option to use URI. Here is the example to create a list of type Uri, May this will help you.

List<Uri> listUri = new List<Uri>();

  listUri.Add(new Uri(""));

Upvotes: 2

Related Questions