Doombox
Doombox
CC#
Created by PocketPixie on 10/19/2024 in #help
Where is the letter of the array saved?
in this case you're just counting each time you find a match, equally you could just store the index of the first ocurrence and break; out of the loop
7 replies
CC#
Created by PocketPixie on 10/19/2024 in #help
Where is the letter of the array saved?
precisely, this is pretty much the most basic way to search for anything in any language, good old linear search, what you do when you find a result is sort of irrelevant
7 replies
CC#
Created by PocketPixie on 10/19/2024 in #help
Where is the letter of the array saved?
the for loop and str[i] are purely the act of scanning the page, they are just the mechanism by which you look
7 replies
CC#
Created by PocketPixie on 10/19/2024 in #help
Where is the letter of the array saved?
that's functionally how that bit of code works
7 replies
CC#
Created by PocketPixie on 10/19/2024 in #help
Where is the letter of the array saved?
imagine you are reading a page in a book, you have a scrap piece of paper and a pen, you scan the page letter by letter, each time you see a d you make a little mark on the bit of scrap paper, at the end you have a count of the occurrences of the letter d but no record of where they are or on what context they were used, just that you saw them
7 replies
CC#
Created by MerryToad on 8/24/2024 in #help
Is it possible to add Markup support to this text editor I made in Winforms?
a cursory google seems to confirm that, all I could find was a nuget package with three versions released in the space of a couple days and the link to the repo for it is dead
5 replies
CC#
Created by MerryToad on 8/24/2024 in #help
Is it possible to add Markup support to this text editor I made in Winforms?
I highly doubt anyone's made a native markdown control for winforms
5 replies
CC#
Created by MerryToad on 8/24/2024 in #help
Is it possible to add Markup support to this text editor I made in Winforms?
Probably converting markdown to html and then using a web control? I don't use winforms but that would be my first thought
5 replies
CC#
Created by sashok on 6/28/2024 in #help
Unable to get the FieldInfo's value
but if you know for sure it's a Unity problem it might be a bit easier to find a solution with google at least
7 replies
CC#
Created by sashok on 6/28/2024 in #help
Unable to get the FieldInfo's value
might have to use type.GetFields(BindingFlags.Instance | BindingFlags.Public) but I'm not 100%, I try to avoid reflection in Unity
7 replies
CC#
Created by sashok on 6/28/2024 in #help
Unable to get the FieldInfo's value
very much a "works on my machine" moment
7 replies
CC#
Created by sashok on 6/28/2024 in #help
Unable to get the FieldInfo's value
No description
7 replies
CC#
Created by The Fog from Human Resources on 6/18/2024 in #help
Avalonia ViewLocator not ViewLocating
or calling new MainViewModel() somewhere
9 replies
CC#
Created by The Fog from Human Resources on 6/18/2024 in #help
Avalonia ViewLocator not ViewLocating
How is ContentViewModel being bound in your view? Though that shouldn't really matter, if you're setting that property to a value, Avalonia shouldn't be setting it back to null
9 replies
CC#
Created by IVIICHAELxx on 3/9/2024 in #help
How can I fetch identical strings concatenated with 1 and so on at the end through this dictionary
or if you know 100% that the maximum number of any instance is say 10, you could just do a query for all 10 in a for loop, which may or may not be a bit more efficient too, ymmv
10 replies
CC#
Created by IVIICHAELxx on 3/9/2024 in #help
How can I fetch identical strings concatenated with 1 and so on at the end through this dictionary
if you know 100% that att2 would only exist if att1 also definitely existed you could use the first solution I posted which would be a bit more efficient
10 replies
CC#
Created by IVIICHAELxx on 3/9/2024 in #help
How can I fetch identical strings concatenated with 1 and so on at the end through this dictionary
it's a little inefficient because you're doing a string comparison on the entire dictionary, but it would get everything that starts with a given name
10 replies
CC#
Created by IVIICHAELxx on 3/9/2024 in #help
How can I fetch identical strings concatenated with 1 and so on at the end through this dictionary
yup
foreach(var result in someDictionary.Where(x => x.Key.StartsWith("keyframe_rope"))
{
// do something with the key/value pair "result" here.
}
foreach(var result in someDictionary.Where(x => x.Key.StartsWith("keyframe_rope"))
{
// do something with the key/value pair "result" here.
}
would do that
10 replies
CC#
Created by IVIICHAELxx on 3/9/2024 in #help
How can I fetch identical strings concatenated with 1 and so on at the end through this dictionary
var baseName = "keyframe_rope";
var searchName = baseName;
var i = 1;
while(someDictionary.TryGetValue(searchName, out var res))
{
// do something with the result here
searchName = $"{baseName}{i++}";
}
var baseName = "keyframe_rope";
var searchName = baseName;
var i = 1;
while(someDictionary.TryGetValue(searchName, out var res))
{
// do something with the result here
searchName = $"{baseName}{i++}";
}
would work with the dictionary itself and prevent you just querying every key this assumes that every index is in there with no gaps or you could do this:
foreach(var result in someDictionary.Where(x => x.Key.StartsWith("keyframe_rope"))
{
// do something with the key/value pair "result" here.
}
foreach(var result in someDictionary.Where(x => x.Key.StartsWith("keyframe_rope"))
{
// do something with the key/value pair "result" here.
}
which would just broadly get them all regardless of that, whilst being a bit easier to read :catshrug:
10 replies
CC#
Created by IVIICHAELxx on 3/9/2024 in #help
How can I fetch identical strings concatenated with 1 and so on at the end through this dictionary
are you looking for basically every instance of keyframe_rope_n in a dictionary where n is unknown?
10 replies