How to convert convert type System.Collections.Specialized.StringCollection to string[]



some set of functions in my class library accepts string[] as parameter i want to convert my System.Collections.Specialized.StringCollection to string array. is it possible with some one liner or i have to create array with loop?


Related to : How to convert convert type System.Collections.Specialized.StringCollection to string[]
How to write contents of System.Collections.Specialized.StringCollection to file?
Programming Languages

I have had no luck searching the obvious places for an answer to why using File.WriteAllLines(); doesn't work when outputting a StringCollection:


static System.Collections.Specialized.StringCollection infectedLog = new System.Collections.Specialized.StringCollection();

Omitting code here that has populated infectedLog.......


File.WriteAllLines(@"C:CustomSearchInfectedFiles.txt", infectedLog);

Could anyone either tell me what I am doing wrong, or point me in the direction of an explanation that will please?


How to convert convert type System.Collections.Specialized.StringCollection to string[]
Programming Languages

some set of functions in my class library accepts string[] as parameter i want to convert my System.Collections.Specialized.StringCollection to string array. is it possible with some one liner or i have to create array with loop?


Cannot add to System.Collections.Specialized.StringCollection in VB
Programming Languages

In the My.Settings of my visual basic project, I have a setting labeled "TEXTHISTORY" which is a System.Collections.Specialized.StringCollection. I have a combobox on the form, and when the user presses the enter key, the text from the combobox is added to the setting. However, when I use: My.Settings.TEXTHISTORY.Add(Combobox1.Text) I get a "Object reference not set to an instance of an object." error. Any ideas on how to fix this?


EDIT:
I figured out what had happened, but I will leave this post here for any others who may have the same issue. The problem was I had not generated the necessary XML

Cannot implicitly convert type 'string' to 'System.Collections.Generic.List<string>'
Programming Languages

This question has probably been answered hundreds of times, but here goes.


I have this chunck of code:


private void PopulateStringDropdownList(List<ObjectInfo> listObject,
object selectedType = null)
{
List<string> listString = listObject.OrderBy(x => x.m_Type).ToString();
for (int i = 0; i < listString .Count; i++)
{
for (int j = i + 1; j < listString .Count; j++)
{
if (String.Equals(listString [i], listString [j]))
{
listString.RemoveAt(j);

Cannot implicitly convert type System.Collections.Generic.Dictionary<System.Tuple<int,int,string>, AnonymousType#1>
Programming Languages

I have the following dictionary in a method:


var nmDict = xelem.Descendants(plantNS + "Month").ToDictionary(
k => new Tuple<int, int, string>(int.Parse(k.Ancestors(plantNS + "Year").First().Attribute("Year").Value), Int32.Parse(k.Attribute("Month1").Value), k.Ancestors(plantNS + "Report").First().Attribute("Location").Value.ToString()),
v => {
var detail = v.Descendants(plantNS + "Details").First();
return
new
{
BaseHours = detail.Attribute("BaseHours").Value,
OvertimeHours = d
Cannot implicitly convert type 'System.Uri' to 'System.Collections.Generic.List<string>' ERROR
Programming Languages

I am using HTML Agility to get all the images since image dont always have absolute path i am trying to do following. But line marked below in the code generates error


Cannot implicitly convert type 'System.Uri' to 'System.Collections.Generic.List'


I am not sure how to fix this i tried so many option but keep on getting one or the other error


List<String> imgList = (from x in doc.DocumentNode.Descendants("img")
where x.Attributes["src"] != null
select x.Attributes["src"].Value.ToLower()).ToList<String>();
List<String> AbsoluteImageUrl = new

Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .