.logik.
.logik.
CC#
Created by zandose on 3/15/2023 in #help
❔ I'm trying to convert a Vector3 string to a Vector3 but the numbers returned aren't correct.
looks good to me, don't forget to $close if there are no more questions
11 replies
CC#
Created by zandose on 3/15/2023 in #help
❔ I'm trying to convert a Vector3 string to a Vector3 but the numbers returned aren't correct.
The string methods you're using do not affect StringToConvert, they return an object which you're not saving to a variable. Currently what vector3 = new Vector3(StringToConvert[0], StringToConvert[1], StringToConvert[2]); is doing is vector3 = new Vector3('0', '.', '5'); which should likely be evident in your debug logs. For example, StringToConvert.Split(','); will return you a string array which needs to be saved to a string[] variable. Alternatively just chain the methods and save it into a float[] variable. Also your LINQ is going to throw an error because you need to be parsing part as opposed to the initial string.
11 replies
CC#
Created by FricativeMelon on 3/7/2023 in #help
❔ No Build Action option in Property pages
11 replies
CC#
Created by FricativeMelon on 3/7/2023 in #help
❔ No Build Action option in Property pages
If you hit F4 or go to View > Properties Window, that should open a little panel on the bottom right of Visual Studio. Then by clicking the bitmap in your solution explorer you should get the options there
11 replies
CC#
Created by FricativeMelon on 3/7/2023 in #help
❔ No Build Action option in Property pages
I'm not familiar with property pages but I think you should be able to access it through the property window directly
11 replies
CC#
Created by TypicalSoldier on 3/7/2023 in #help
✅ Index was outside of bounds of the array
No stress, if theres no other questions, don't forget to $close
21 replies
CC#
Created by TypicalSoldier on 3/7/2023 in #help
✅ Index was outside of bounds of the array
but hopefully you understand the problem you were having before?
21 replies
CC#
Created by TypicalSoldier on 3/7/2023 in #help
✅ Index was outside of bounds of the array
foreach (string s in letterTokens) {
morseToEnglishDictionary.TryGetValue(s, out englishOutput);
morseOutputTextBox.AppendText(englishOutput.ToString());
}
foreach (string s in letterTokens) {
morseToEnglishDictionary.TryGetValue(s, out englishOutput);
morseOutputTextBox.AppendText(englishOutput.ToString());
}
21 replies
CC#
Created by TypicalSoldier on 3/7/2023 in #help
✅ Index was outside of bounds of the array
even better is probably a foreach loop
21 replies
CC#
Created by TypicalSoldier on 3/7/2023 in #help
✅ Index was outside of bounds of the array
I still think a for loop is preferred here
21 replies
CC#
Created by TypicalSoldier on 3/7/2023 in #help
✅ Index was outside of bounds of the array
so you should use letterTokens.Length to limit your loop
21 replies
CC#
Created by TypicalSoldier on 3/7/2023 in #help
✅ Index was outside of bounds of the array
but you're splitting based on tokens and iterating over the tokens
21 replies
CC#
Created by TypicalSoldier on 3/7/2023 in #help
✅ Index was outside of bounds of the array
morseInput.Length is the number of characters in the string
21 replies
CC#
Created by TypicalSoldier on 3/7/2023 in #help
✅ Index was outside of bounds of the array
Oh I've figured it out
21 replies
CC#
Created by TypicalSoldier on 3/7/2023 in #help
✅ Index was outside of bounds of the array
Can you share the sample input that you're using?
21 replies
CC#
Created by TypicalSoldier on 3/7/2023 in #help
✅ Index was outside of bounds of the array
Probably should be morseIndex < morseInput.Length in the for condition. If you have 5 objects your loop will run 6 times for index = 0,1,2,3,4,5. If you change it to < instead of <= then it will only run 5 times. However the way the index variable is redundant because thats what the morseIndex is doing. Also there are operations that you're performing in the loop that only need to be executed once such as morseInput.Split and declaring the char variable. You can look to move them outside the loop to improve the efficiency
21 replies
CC#
Created by .logik. on 3/6/2023 in #help
✅ Help with non-nullable field must contain a non-null value when exiting constructor.
Great - thanks for that. I'm probably not going to use it because I agree that I should be setting the field directly. I'll do some digging to see when/if its ever appropriate to be using the property to set backing fields in a constructor. Appreciate your assistance!
13 replies
CC#
Created by .logik. on 3/6/2023 in #help
✅ Help with non-nullable field must contain a non-null value when exiting constructor.
so to confirm - if i wanted to use that attribute, it would look like the below? or does the attribute need to go before the property?
public Location CurrentLocation
{
get => _currentLocation;
[MemberNotNull(nameof(_currentLocation))]
set
{
_currentLocation = value;
OnPropertyChanged();
}
}
public Location CurrentLocation
{
get => _currentLocation;
[MemberNotNull(nameof(_currentLocation))]
set
{
_currentLocation = value;
OnPropertyChanged();
}
}
13 replies
CC#
Created by .logik. on 3/6/2023 in #help
✅ Help with non-nullable field must contain a non-null value when exiting constructor.
Ahh that makes sense, yeah looking back at it now, I should probably be setting the field directly
13 replies
CC#
Created by EinfachNurBaum on 2/14/2023 in #help
❔ Item.Is a Number
Maybe you're looking for the Char.IsDigit static method?
14 replies