Mass
Mass
Explore posts from servers
CC#
Created by Mass on 4/15/2024 in #help
✅ Inconsistent accessibility: property type is less accessible than property.
thanks, will take a peek for sure!
45 replies
CC#
Created by Mass on 4/15/2024 in #help
✅ Inconsistent accessibility: property type is less accessible than property.
yeah that makes sense, thanks for all that info!
45 replies
CC#
Created by Mass on 4/15/2024 in #help
✅ Inconsistent accessibility: property type is less accessible than property.
gotta quickly throw laundry into the washing machine so I'll brb
45 replies
CC#
Created by Mass on 4/15/2024 in #help
✅ Inconsistent accessibility: property type is less accessible than property.
oh yeah no in that case, not using that
45 replies
CC#
Created by Mass on 4/15/2024 in #help
✅ Inconsistent accessibility: property type is less accessible than property.
at least not manually constructed
45 replies
CC#
Created by Mass on 4/15/2024 in #help
✅ Inconsistent accessibility: property type is less accessible than property.
not sure how I'd do that for UWP pages though, since they're not really constructed as far as I know
45 replies
CC#
Created by Mass on 4/15/2024 in #help
✅ Inconsistent accessibility: property type is less accessible than property.
oh wait reading up on dependency injection, I do think I've used this before (at the very least in other languages), at least if it's just about passing through dependencies as a parameter in a constructor, I feel like that just happens naturally in OOP
45 replies
CC#
Created by Mass on 4/15/2024 in #help
✅ Inconsistent accessibility: property type is less accessible than property.
I'm not using it but I'm down to learn about it
45 replies
CC#
Created by Mass on 4/15/2024 in #help
✅ Inconsistent accessibility: property type is less accessible than property.
main problem I'm immediately running into trying to do that is that I actually have 3 different lists (I only mentioned one because the number was irrelevant to my problem) they have different custom objects (though they all inherit from the same abstract base class) but I'm not entirely sure how I'd pass all 3 lists as a single parameter in C#
45 replies
CC#
Created by Mass on 4/15/2024 in #help
✅ Inconsistent accessibility: property type is less accessible than property.
:o
45 replies
CC#
Created by Mass on 4/15/2024 in #help
✅ Inconsistent accessibility: property type is less accessible than property.
yuup
45 replies
CC#
Created by Mass on 4/15/2024 in #help
✅ Inconsistent accessibility: property type is less accessible than property.
assuming a <ListView> in UWP counts, then yes
45 replies
CC#
Created by Mass on 4/15/2024 in #help
✅ Inconsistent accessibility: property type is less accessible than property.
I read information from a CSV file (though not because I want to) it's basically like this:
FileOpenPicker fileOpenPicker = new FileOpenPicker();
fileOpenPicker.FileTypeFilter.Add(".csv");
StorageFile result = await fileOpenPicker.PickSingleFileAsync();
if (result == null) return;
string csvText = await FileIO.ReadTextAsync(result);
using (StringReader reader = new StringReader(csvText)) {
string line;
while ((line = reader.ReadLine()) != null) {
string[] cells = line.Split(',');
...
MyList.Add(new CustomObject(cells));
...
}
}
FileOpenPicker fileOpenPicker = new FileOpenPicker();
fileOpenPicker.FileTypeFilter.Add(".csv");
StorageFile result = await fileOpenPicker.PickSingleFileAsync();
if (result == null) return;
string csvText = await FileIO.ReadTextAsync(result);
using (StringReader reader = new StringReader(csvText)) {
string line;
while ((line = reader.ReadLine()) != null) {
string[] cells = line.Split(',');
...
MyList.Add(new CustomObject(cells));
...
}
}
45 replies
CC#
Created by Mass on 4/15/2024 in #help
✅ Inconsistent accessibility: property type is less accessible than property.
right tbh it might not need to be static anymore because I changed the code up this issue was (hopefully) the last hurdle in that change xD
45 replies
CC#
Created by Mass on 4/15/2024 in #help
✅ Inconsistent accessibility: property type is less accessible than property.
yup, turns out it was because my CustomObject class wasn't public :D thanks for the help guys!
45 replies
CC#
Created by Mass on 2/13/2024 in #help
How to set a default method for an optional parameter in a method.
oh yeah I'm not used to C# naming conventions yet 😛
15 replies
CC#
Created by Mass on 2/13/2024 in #help
How to set a default method for an optional parameter in a method.
Something like that was actually gonna be my next step, so thanks a lot! After rewriting my own code to look be more similar to yours, I have this:
T GetInput<T>(string prompt = "> ", Func<T, bool>? condition = null, string errMsg = "Please enter a valid value.") where T : IParsable<T> {
while (true) {
Console.Write(prompt);
bool valid = T.TryParse(Console.ReadLine(), null, out var value) && (condition?.Invoke(value) ?? true);
if (valid) return value;
else Console.WriteLine(errMsg);
}
}
T GetInput<T>(string prompt = "> ", Func<T, bool>? condition = null, string errMsg = "Please enter a valid value.") where T : IParsable<T> {
while (true) {
Console.Write(prompt);
bool valid = T.TryParse(Console.ReadLine(), null, out var value) && (condition?.Invoke(value) ?? true);
if (valid) return value;
else Console.WriteLine(errMsg);
}
}
My only concern now is that the value being returned might be null.
15 replies
CC#
Created by Mass on 2/13/2024 in #help
How to set a default method for an optional parameter in a method.
that's perfect, thanks!
15 replies