C# Compile Error
int[] ddfv = DropDownList1.SelectedItem.Value.ToString().Split('_').Select(part => int.Parse(part, System.Globalization.NumberStyles.Integer)).ToArray();
error : there is no .Select in String [] :(
there is a value like "1开发者_运维百科_2" I need to save 1 and 2 as integer values :)
Select is an extension method, defined in the System.Linq
namespace.
The reason for the error is probably one of these:
- you are missing the reference to the assembly
System.Core
- you are missing the using directive for Linq (
using System.Linq;
) - you are not using .NET 3.x
int[] value = DropDownList1.SelectedItem.Value.ToString().Split('_'); in the above "value" contains all split values, use index to fetch respective values ex: if DropDownList selected values is course_name_123 so i want only character before _ use the first line code and value[0] contains ur new data
精彩评论