All lists deleted [closed] - c#

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 3 years ago.
Improve this question
I want to clear just birkatmankontur list but this code clears all lists in my program
katmankonturlari.Add(ii, birkatmankontur);
katmankonturlari.ToList();
birkatmankontur.Clear();

You probably want something like this:
// Create a shallow copy of birkatmankontur and add it into katmankonturlari
katmankonturlari.Add(ii, birkatmankontur.ToList());
// Clear original birkatmankontur;
// note, that katmankonturlari contains birkatmankontur's copy
birkatmankontur.Clear();

Related

Is there a way to compare the exact value of a string in C# [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 1 year ago.
Improve this question
So I made a simple c# file reader because I was bored and added an if statement to filter the results. But when I ran it, it gave me more results than I wanted. I was supposed to get
276, 2, and there was only one line inside the file with that value, but I got multiple. I checked the file and it had lines ending with the same value. I tried string.Equals(line, "276, 2") but it gave me the same results. I doubt there isn't something in c# that doesn't solve this issue.
You can use Regex, as it's mentioned in this issue
bool result = Regex.IsMatch(line, "\\b276, 2\\b");

How to convert Point2f[] to Point[] OpenCV [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 2 years ago.
Improve this question
Other than creating a function that puts elements one by one, is there a method that converts Point2f[] to Point[] datatype?
You can use Opencv convertTo method.
cv::Mat A = loadMat("mymat.xml"); // See function loadMat in the question!
A.convertTo(A, CV_64F);
Picked from here. Pick your appropriate data type.

Get particular part(s) from String in C# [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 5 years ago.
Improve this question
I'm reading an email and performing a few operations.
In email it can't be in defined format as below,
Email formats:
Hi Team,
Please create 7025-45-365-14, 9851-98-524-12
5741-55-452-45
Thanks
MailItem.Body = "Hi Team,\r\n\r\n \r\n\r\nPlease create 7025-45-365-14, 9851-98-524-12\r\n\r\n5741-55-452-45.\r\n\r\n \r\n\r\nThanks\r\n"
My goal is to exact only the string parts into a loop one by one as below,
1st loop > 7025-45-365-14
2nd loop > 9851-98-524-12
3rd loop > 5741-55-452-45
I tried various logic but I can't extract as I need. Can someone help me?
To extract digits in that pattern (4-2-3-2)
foreach (var m in new Regex(#"\b(\d{4}-\d{2}-\d{3}-\d{2})\b").Matches(mail))
Console.WriteLine(m.Value);

Combine first and last name into full name c# [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
So here is what I have
txtFull.Text = txtFirst.Text + ā€œ\nā€ + txtSecond.Text;
not sure why its not working
You should use the quotes " (Unicode: U+0022) for strings instead of the comma quotation mark ā€œ...ā€ (Unicode: U+201C and U+201D)

Appending multiple CSV's in c# [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I am generating multiple CSV's in a folder ,I have to merge all of them and make one file.
P.s.
1.They all will have same headers.
2.Their names are not fixed and will be changed every other day acc to date and some other parameters.
Not really tested but should give you an idea:
var allCsv = Directory.EnumerateFiles("Src-Path", ".*csv", SearchOption.TopDirectoryOnly);
string[] header = { File.ReadLines(allCsv.First()).First(l => !string.IsNullOrWhiteSpace(l)) };
var mergedData = allCsv
.SelectMany(csv => File.ReadLines(csv)
.SkipWhile(l => string.IsNullOrWhiteSpace(l)).Skip(1)); // skip header of each file
File.WriteAllLines("Dest-Path", header.Concat(mergedData));
Note that you have to add using System.Linq;

Categories

Resources