Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 1 year ago.
Improve this question
Is there a posiblity to store and load a guid list in a file?
List<Guid> targetFaceIds = new List<Guid>();
foreach (var imageFileName in targetImageFileNames)
{
List<DetectedFace> detectedFaces = await DetectFaceRecognize(client, _imagePath + imageFileName, recognitionModel);
targetFaceIds.Add(detectedFaces[0].FaceId.Value);
}
In my programm I want to store 'targetFaceIds' in a file is that possible and how can I load it back form the file in my programm.
In my 'targetFaceIds' is this:
You can use guid.ToString to convert it to a string and Guid.Parse to parse it back to a Guid:
File.WriteAllLines(path, targetFaceIds.Select(g => g.ToString())); // write
targetFaceIds = File.ReadAllLines(path).Select(Guid.Parse).ToList(); // read
Related
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 5 years ago.
Improve this question
I have a string like:
43965.96000,16933.986,404689.986,5814892.171,77.464,52.47585589,13.59670032,77.464,0.675,-0.223
I want to just keep the string which is bold in characters between commas. How can I do that?
To take your question literally, you could do write a method to split the string by comma and just take the element at the 5th index:
string ParseData(string data)
{
return data.Split(',')[5];
}
So you'll be able to do something like:
string data = "43965.96000,16933.986,404689.986,5814892.171,77.464,52.47585589,13.59670032,77.464,0.675,-0.223";
string result = ParseData(data); // Result = "52.47585589"
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 6 years ago.
Improve this question
I am having file name as below.
i need only sample.xml as result.
sample.xml.jued.783737377365474.da
Please help me on this. thanks in Advance
File name can have one extension only:
string path = "sample.xml.jued.783737377365474.da";
// ".da"
var ext = Path.GetExtension(path);
However, in case you have a origin.extension.[some data].da pattern, you can split the file name by . and take first two items:
// sample.xml
var origin = String.Join(".", Path
.GetFileName(path)
.Split(new char[] { '.' }, 3)
.Take(2));
Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
my file names are
myfile_TCL.txt;
myfile_TCL_i1.txt;
myfile_TCL_i2.txt;
myfile_TCL_i3.txt;
testfile_TCL_i1.txt;
testfile_TCL_i2.txt;
my output should be "myfile_TCL_i3" and "testfile_TCL_i2" which are latest modified files for two different files.
Note:I may have so many number of different files and their modified files.
you could do it with a LINQ statement like this
var fi = new DirectoryInfo("c:\\temp");
var order = fi.GetFiles().OrderBy(x => x.LastWriteTime);
//or
var orderdesc = fi.GetFiles().OrderByDescending (x => x.LastWriteTime);
edit 1
foreach (var file in order)
{
Console.WriteLine(file.FullName);
}
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
i have textedit1.text it has a value 2 in my winform,..and then i have timedit called timePekerjaanStart value 04:00:00 . the case is i wanna addition between textedit1 and timePekerjaanStart ,i catch the result in timestamp called timePekerjaanEnd. so , i wanna get the result timePekerjaanEnd = textedit1 + timePekerjaanStart as like 2 + 04:00:00 = 06:00:00
You've not provided any attempts to solve it yourself but it's really quite straight forward:
var theHoursToAdd = int.Parse(textedit1.Text); // Error handling needs to be added
var startTime = timePekerjaanStart.Time;
timePekerjaanEnd.Time = startTime.AddHours(theHoursToAdd);
Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I want to replace the string Prab\A\kar to Prab\kar
I have tried like this
string temp = #"prab\A\kar";
temp = temp.Replace(#"\A\", #"\");
and i got as "prab\\kar". As i mentioned in the title I want it as "Prab\kar"
temp = temp.Replace(#"\A\", #"\");