So in school We are learning to use WPF for user interfaces and i've came along a problem in my c# code.
List<string> list = new List<string>();
list.Add("asdfasdf");
Visual studio gives a couple of errors for "list.Add" but basicaly it says "The name 'list' does not exist in current context".
I have no idea whats wrong and would apreciate anyones help.
I think you must add to your code:
using System;
using System.Collections.Generic;
Please add all your code if you want more help.
我认为能够调用 list.Add 你必须从函数或 void 调用它(例如 static void main())
Based on your explanation you seem to be missing a reference. Add this to where you reference your libraries.
using System.Collections.Generic;
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.