Categories > Coding > C# >
Welp me optimize terrible code
Posted
https://cdn.discordapp.com/attachments/986313395882037258/988504638066147389/unknown.png
how optimize
Replied
Can't you just add
using Microsoft.Win32;
And then do the OpenFileDialog without the shortcut?
That kinda makes the code bad.
Cancel
Post
Random quote here...
Replied
Uh so if you use avalonedit it has built in load function which u can use.
Sorry if im wrong, i havent touch wpf/c# in ages lol + i write this without ide
Also make sure you using the win32 one
var FileDialog = new OpenFileDialog()
{
Title = "Open File",
Filter = "*Txt (*txt)|*.txt|Lua (*lua)|*.lua"
};
if (FileDialog.ShowDialog().GetValueOrDefault())
Editor.Load(FileDialog.FileName);
Cancel
Post
Im netral, not evil, not too kind either.
Replied
Just dont create a OpenFileDialog everytime, create once and reuse it
and " == true"💀
Cancel
Post
https://imgur.com/a/oOomuUo
Users viewing this thread:
( Members: 0, Guests: 1, Total: 1 )
Cancel
Post