I'm trying to create a C# WinRT component for use in metro style applications (win8) and am having trouble with projected types.
It seems the IVector<> and IMap<> data types are inaccessible due to their protection level?
My Sample WinMD Library has one class:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Windows.Foundation.Collections;
namespace ClassLibrary1
{
public sealed class Class1
{
public IVector<string> foo()
{
return new List<string>();
}
}
}
I get the following compiler errors:
Inconsistent accessibility: return type 'Windows.Foundation.Collections.IVector<string>' is less accessible than method 'ClassLibrary1.Class1.foo()'
'Windows.Foundation.Collections.IVector<string>' is inaccessible due to its protection level
What am I doing wrong?
EDIT:
Ah ha!
Turns out I should not be using the WinRT type names directly, but using their translated .NET names instead.
The correct code looks like this:
namespace ClassLibrary1
{
public sealed class Class1
{
public IList<string> foo()
{
return new List<string>();
}
}
}