473,414 Members | 1,729 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,414 software developers and data experts.

duplicate StringCollections and RegEx problem

Hi,

I have some question.
1. I have a filled StringCollection A. When I assign it to an
StringCollection B and remove a value from B, because strings are only
referenced, right? But now I need a copy of this StringCollection within
a function. How do I duplicate a StringCollection the easiest way? Do I
have to iterate through the StringCollection and copy the single values
one by one?
2. I have a function with an RegEx which extracts a value from a
logfile. When I look at the match of the RegEx everything is fine. But
when I look at the returned value within the calling function during
debugging, SharpDevelop shows me that there are strange things added to
the return string, e. g. "s)" or some windings like symbols or the
funniest
"c:\windows\assembly\gac_32\mscorlib\2.0.0.0_b77a5 c561934e089\mscorlib.dll"
Does anybody have an idea why this happens? Is this a known bug of
SharpDevelop?

Best regards for your hints,

Andi
Sep 13 '06 #1
1 1258
As for 1:
StringCollection b = new StringCollection();

b.Add("Hello");

b.Add("World");

string[] s = new string[b.Count];

b.CopyTo(s, 0);

StringCollection c = new StringCollection();

c.AddRange(s);

foreach (string a in c)

{

System.Diagnostics.Debug.Write(a);

}
"Andreas Bauer" <bu**@gmx.netschreef in bericht
news:ee**********@online.de...
Hi,

I have some question.
1. I have a filled StringCollection A. When I assign it to an
StringCollection B and remove a value from B, because strings are only
referenced, right? But now I need a copy of this StringCollection within
a function. How do I duplicate a StringCollection the easiest way? Do I
have to iterate through the StringCollection and copy the single values
one by one?
2. I have a function with an RegEx which extracts a value from a
logfile. When I look at the match of the RegEx everything is fine. But
when I look at the returned value within the calling function during
debugging, SharpDevelop shows me that there are strange things added to
the return string, e. g. "s)" or some windings like symbols or the
funniest
"c:\windows\assembly\gac_32\mscorlib\2.0.0.0_b77a5 c561934e089\mscorlib.dll"
Does anybody have an idea why this happens? Is this a known bug of
SharpDevelop?

Best regards for your hints,

Andi

Sep 13 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
by: Voetleuce en fênsievry | last post by:
Hello everyone. I'm not a JavaScript author myself, but I'm looking for a method to remove duplicate words from a piece of text. This text would presumably be pasted into a text box. I have,...
3
by: Jon Maz | last post by:
Hi All, Am getting frustrated trying to port the following (pretty simple) function to CSharp. The problem is that I'm lousy at Regular Expressions.... //from...
4
by: aevans1108 | last post by:
expanding this message to microsoft.public.dotnet.xml Greetings Please direct me to the right group if this is an inappropriate place to post this question. Thanks. I want to format a...
7
by: bill tie | last post by:
I'd appreciate it if you could advise. 1. How do I replace "\" (backslash) with anything? 2. Suppose I want to replace (a) every occurrence of characters "a", "b", "c", "d" with "x", (b)...
6
by: Dave | last post by:
I'm struggling with something that should be fairly simple. I just don't know the regext syntax very well, unfortunately. I'd like to parse words out of what is basically a boolean search...
17
by: clintonG | last post by:
I'm using an .aspx tool I found at but as nice as the interface is I think I need to consider using others. Some can generate C# I understand. Your preferences please... <%= Clinton Gallagher ...
3
by: jg | last post by:
I made a mistake somewhere in my vb code and I look, check and read against the articles and help on regex, I still can't find the mistake I made. I know my test string and the test patterns...
6
by: Talin | last post by:
I've run in to this problem a couple of times. Say I have a piece of text that I want to test against a large number of regular expressions, where a different action is taken based on which regex...
7
by: =?Utf-8?B?amFj?= | last post by:
Hi, I have problems with following code and don’t find the bug : // Set ArrayList aArray = new ArrayList(); regStr = new Regex(@"\?)*(\d+)\]"); if(text != null && regStr.IsMatch(text))...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.