WinUI or .NET MAUI?
I'm thinking to develop a note taking app. Am confused, which one I should go for? WinUI? MAUI? I'm not sure whether the app will be cross platform or not. probably it will be exclusive to windows only. Still should I choose MAUI or WinUI is fine? I have to learn both of the frameworks from the scratch, so which one I should choose?
If it's Windows-only, WinUI is the better choice of these two. MAUI is made for cross-platform, which means some things won't be as straightforward as you might think because they have to be designed with iOS and Android in mind as well as Windows. It's also sort of troublesome to get going in MAUI right now because a ton of packages that supported Xamarin are "supporting MAUI" but not Windows projects yet. (Looking at you, System.Reactive.)
If cross platform Maui. If windows only winui.
Fwiw Maui isn't ready for prime time yet.
For a very comprehensive overview of all the desktop app choices, I highly recommend this video— https://youtu.be/8NdJaztrNk8
Skip the first 5 minutes to dive in after the intros. Plenty of really good info to help you make your choice
probably it will be exclusive to windows only
Then don't go with MAUI. MAUI is a mobile-first framework where Windows and macOS only exist as an afterthought.
If you want a desktop-first cross-platform framework, take a look at Avalonia.
Ok, I was checking Avalonia, but it seems that it is not accessible for screen readers :( And I have to develop the app for blind people
Build it with WinUI on windows and then you can get it working on other platforms with Uno Platform
Avalonia? I think WinUI still need a bunch of weird shit like uwp tools, manifest files, and other garbage
You don't have to use a manifest, you can also create an unpackaged WinUI app. But also, why would you consider the manifest garbage in the first place? Packaged apps have pretty obvious benefits for consumers compared to unpackaged ones.
Never tried Avalonia actually. Is it better then WinUI? and how is the learning curve? Also, is it accessible for screen readers? :-)
If it's for fun/study, go with MAUI. You have an idea for the end product, there's tons out there already for every platform already. Why not use this as an opportunity to learn. MAUI might not be big now, but there's a real chance in 3-5 years it might be a very common platform due to it's write once run anywhere approach. And with a note taking app, something that would be useful on Mac, iOS, Windows, and Android... it screams "run me everywhere!"
As an update from this thread, I ended up going with Jint JavaScript interpreter for my program's scripting feature. The runner-up is Nlua which actually seems to be the preferred choice. If Jint doesn't work out for some reason, I will try Nlua. Also, for template rendering, there is scriban and Handlebars, one of which I'll use for the template that displays the room description, contents, exits, etc.
But, anyway, on to the cool part which is a demo of my program's first scripted event! In this demo, I follow these steps:
Begin outside the white house from Zork 1
Open the mailbox and read the note inside
Close the mailbox
Go into edit mode and edit the mailbox
Add an event that will fire when I invoke an OPEN action on the mailbox
Add an event handler that will execute this script:
args.CancelCurrent = true;args.Message = "As soon as the lid to the mailbox begins to open, it snaps shut!";
args
is passed in from the event manager. CancelCurrent = true
cancels the event so that the mailbox does not open and also displays a special message.
Once I got this working, it was the coolest thing, and it only required a few extra lines of code. Thanks to everyone who offered their help in that other thread!
Edit: This was originally an animated GIF, but got converted to a video. Click on it and you can seek through it if you missed a part.
https://i.redd.it/mg196e8zj5g91.gifI have been a c# developer for last 8 yrs now. I know all the theories. I have done 20 plus courses on various topics in c#. I have watched almost all videos of Iamtimcorey YouTube channel. Many from NickChapsas as well. While watching videos it makes perfect sense and i can able to understand everything. But when a taak is given to me i have no idea how to start. Where to implement the theory in what features. Someone if told me what to do, then i am more than capable of doing that. I have problem of doing on my own. I am struggling to put all the theories to solution. That’s why I struggle in the coding round in the interview. Kindly help.
I am writing an interactive fiction builder where users can build their own games. There will be times when scripting will be required. For example, my builder supports adding custom attributes to game objects, so you could create a lantern object and annotate it with "type = lightsource" and "isactive = false". Before displaying a room's contents, the game author could write a script like:
void OnDisplayRoomContents(args a) {
if (
a.Area.Attr("isdark") == true &&
!Player.Items.Any(x =>
x.Attr("type") == "lightsource" &&
x.Attr("isactive) == true
)
) {
a.Display = false;
}
}
Basically, if the player is in a dark room and they don't have an active light source, don't display the room contents (or display something else like "You're likely to be eaten by a grue").
I've just discovered the Microsoft.CSharp.CSharpCodeProvider
namespace which is included in c#, but there is also apparently IronPython. There are probably others. I will also need to evaluate/validate the scripts to prevent malicious code (don't want anyone writing code to delete someone's System32 folder).
Looking forward to good suggestions.
Quite the conundrum, I am not sure which one to use when... What's your rule of thumb?
Other than SQL/C# and the bare basics of knowing how ASP.NET works, what are the things that a new webapp/webdev backend C# programmer is expected to know?
I was checking the job market for non webdev related jobs outside of unity and found practically nothing for things like maui/xamarin/wpf.
A link to the Repository:
https://github.com/huntercfreeman/BlazorStudio
Make sure to clear your cache for the latest demo: https://hunter-freeman-dev.azurewebsites.net/
JavaScript and Python seem to have all the buzz right now, does it seem like c# is underrated? Or ought to be more popular for the career opportunities and uses it has? glad to hear any feedback
Everything that I imagine using local functions for, there's pre-existing way of coding that would function just as well without the language feature. I don't find that it's more readable.
I find it just derails the readability of code.
I have a List<T> and i want it to have no duplicates, I have tried the following:
1- Converting the list to HashSet
var listWithoutDuplicates = new HashSet<T>(listWithDuplicates).ToList();
but i still get duplicate values
2- not adding the object if it already exists
foreach(var item in llistWithDuplicates)
{
if(listWithoutDuplicates.Contains() == false)
{
listWithoutDuplicates.Add(item);
}
}
3- Adding `.Distinct()` after the list like so
listWithDuplicates = listWithDuplicates.Distinct().ToList();
But with no luck in all my attempts, i am trying to filter the list before inserting into a DB using EF, Thanks in advance.
Edit: Thanks for the platinum, i got my answer and my first platinum. I’ll be sure to keep asking questions for the things i struggle with during work here, you guys are awesome!
I had a design where a ‘Func’ ist set from outside, those func is returning a task, that I need to wait for once a specific trigger (like message via channel) has happen. So I thought I just use the task returned an call GetAwaiter().GetResult() and were hoping it will start the task internal:-/ after I find that it clear why it doesn’t throw an exception, because the task may be started from somewhere else. it was obvious my mistake but I was shocked that there was no warning or something similar, pointing me to my mistake…
Yeah now I learned, to call task.Run() or task.Start() before the GetAwaiter().GetResult()
I want to create full stack web project. The problem is that I don't like js and I would like to avoid him and use blazor instead. I did some simple projects with blazor but is it good and sufficient for more complex projects and can replace angular or react?
I have some experience with C# in Unity, but I want to learn to make "normal" programs with C# (which as far as i know is with .net). It's not for anything in particular, I just want to practice a little bit of programming outside of Unity (and I got tired of python lol). I'm still pretty much a beginner, but I don't want to sit through a 6 hour course that teaches me what ✨variables✨ and ✨functions✨ are again, just learn enough to use C# without the need of GetComponent and stuff (or guessing my way through it and making horrible spaghetti code), learn how to use namespaces and all that, maybe make graphical things kinda like pygame or something, if that makes any sense
Here is an example. I have to await for the DBSet to add the user and then i can save it to the database and then return the user object back. Does async even make sense in this case?
[HttpPost]
public async Task<IActionResult> Insert(User user)
{
try
{
await _context.Users.AddAsync(user);
await _context.SaveChangesAsync();
return Ok(user);
}
catch (Exception ex)
{
return Problem(ex.InnerException?.Message);
}
}
Hello, I'm a C# beginner learning through w3chools's course I just read a bit about creating methods to reuse code, so I did this to practice a bit.
Any suggestions are welcome, thanks in advance
Code:
static void Main(string[] args)
{
Console.WriteLine("----------------------------");
TheCalculator();
Console.WriteLine("\nPress Y to continue");
bool keyCheck = KeyRead() == 'Y';
while (true)
{
if (!keyCheck)
{
break;
}
TheCalculator();
Console.WriteLine("\nPress Y to continue");
keyCheck = KeyRead() == 'Y';
}
}
static double CheckNumber(string numString)
{
while(true)
{
double numDoubleTest;
if (double.TryParse(numString, out numDoubleTest))
{
break; //if it can parse to number breaks the loop
}
Console.WriteLine("Not a number \n Try again");
numString = Console.ReadLine();
}
int numDouble = Convert.ToInt32(numString); //normal convertion
return numDouble;//variable
}
static void TheCalculator()
{
Console.WriteLine("Power calculator");
Console.WriteLine("----------------------------");
Console.WriteLine("Please, insert a number");
double baseNumber = CheckNumber(Console.ReadLine());
Console.WriteLine("Please insert an exponet");
double exponetNum = CheckNumber(Console.ReadLine());
double result = Math.Pow(baseNumber,exponetNum);
Console.WriteLine("result is : "+ result);
}
static char KeyRead()
{
var inputKey = Console.ReadKey();
string inputKeyString = Convert.ToString(inputKey.KeyChar);
inputKeyString = inputKeyString.ToUpper();
char inputKeyChar = Convert.ToChar(inputKeyString);
return inputKeyChar;
}
The exercise:
I want to disable garbage collection whenever heap usage is below 256 megabytes to minimize GC pauses. Is the're a way to do this?