个人资料

跳过导航链接首页 > 博客列表 > 博客正文

winRT组件方法传递数组参数

:


编译错误:Method 'BackgroundTasks.Reminder.getCourse(BackgroundTasks.Course[])' has parameter 'Courses' which is an array. In the Windows Runtime, the contents of array parameters must be either readable or writable. Please apply either System.Runtime.InteropServices.WindowsRuntime.ReadOnlyArrayAttribute or System.Runtime.InteropServices.WindowsRuntime.WriteOnlyArrayAttribute to 'Courses'.


public Course getCourse([ReadOnlyArray()]  Course[] Courses) {
	...		
}


解决办法:给传递参数添加ReadOnly或WriteOnly属性


参考:https://docs.microsoft.com/zh-cn/previous-versions/hh975353%28v%3dvs.110%29

admin
最初发表2019/2/16 11:38:46 最近更新2019/2/16 12:01:06 1774
为此篇作品打分
10