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


mhedberg
HOME ยป 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?


Related to : How to convert convert type System.Collections.Specialized.StringCollection to string[]
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

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?


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);



HD Wallpapers
3D
3D Abstract
City
Celebrities
Indian Celebrities
Cars
Travel
Girls
Animals Birds
Movies
Sports
Black White
Nature
Planes
Anime
Food Drink
Dreamy Fantasy
Architecture
Games
Space
Holidays
Flowers
Love
Artistic
Baby
Beach
Bikes Motorcycles
Macro
Computers
Vector
Funny
Army
Textures
Brands
Misc
Music
Other
Privacy Policy - Copyrights Notice - Feedback - Report Violation - RSS 2017 © bighow.org All Rights Reserved .