C
C#

help

❔ Is it possible to put a method into a variable and call the variable?

Aazurlified12/25/2022
like this:
Aazurlified12/25/2022
Or atleast something similar to that
AAngius12/25/2022
A static method, yes A non-static method, no But why do you want to do that here? You can just get the value from this method and print that
Aazurlified12/25/2022
I'm just messing around and trying to learn things not for any particular reason
Mmtreit12/25/2022
That's not exactly true, as long as you have an instance.
AAngius12/25/2022
Huh TIL Thought Funcs and Actions need to be static
Mmtreit12/25/2022
Nope 🙂
Aazurlified12/25/2022
isn't that basically what I'm doing? not sure why it might not be working for me
Mmtreit12/25/2022
Paste your full code
F333fred12/25/2022
You're invoking aMethod With the () after the name
Aazurlified12/25/2022
F333fred12/25/2022
So var method is the thing that aMethod() returns, not aMethod itself You want var method = Object.aMethod; (note the lack of parentheses)
Aazurlified12/25/2022
Oh I see i'm basically doing () twice
Mmtreit12/25/2022
Presumably that code doesn't even compile since aMethod takes an int and you aren't passing one
Aazurlified12/25/2022
although it's telling me this now
Aazurlified12/25/2022
F333fred12/25/2022
Are you using .NET Framework?
AAngius12/25/2022
I started assuming everybody with the green mark next to their name is using Framework lol Microsoft should really hid the (.NET Framework) templates from VS
Mmtreit12/25/2022
Legacy codebases are a huge part of the ecosystem
AAngius12/25/2022
Legacy stuff is already on Framework, no new projects to be made Besides, not saying remove it completely, just slap it into some "show more" dropdown
Mmtreit12/25/2022
I agree if you are creating brand new .NET Framework projects that will not be referenced by other .NET Framework projects you should reconsider your life choices.
Aazurlified12/25/2022
it's not vs it's w3schools code executer lol
AAngius12/25/2022
Why
Aazurlified12/25/2022
if i'm going to use vs, what template should I use if I just want to mess around and run random things?
AAngius12/25/2022
$newproject
MMODiX12/25/2022
When creating a new project, prefer using .NET over .NET Framework, unless you have a very specific reason to be using .NET Framework. .NET Framework is now legacy code and only get security fix updates, it no longer gets new features and is not recommended. https://cdn.discordapp.com/attachments/569261465463160900/899381236617855016/unknown.png
Aazurlified12/25/2022
sick
AAngius12/25/2022
The console will be good for starters
Mmtreit12/25/2022
If you use $code (not screenshots) to paste your exact source code that is failing it will be a lot more clear what the issue you are seeing is.
MMODiX12/25/2022
To post C# code type the following: ```cs // code here ``` Get an example by typing $codegif in chat If your code is too long, post it to: https://paste.mod.gg/
Aazurlified12/25/2022
what's the difference between WPF application and console application?
AAngius12/25/2022
WPF has all the windows and buttons and text inputs and stuff Console is... console Just the text
Mmtreit12/25/2022
Well, unless you go for something like https://github.com/gui-cs/ 🙂
AAccord12/27/2022
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.

Looking for more? Join the community!

Want results from more Discord servers?
Add your server
Recommended Posts
❔ Getting error 500 on form post (using fetch)I'm trying to do a form post (posting a model), but my controller is not being called. When I check❔ Need some help with logicim trying to make a the total defence and attack statistics equal to 35 (they are randomised for 6 p❔ when instancing a class, why do you need to write the class name twice?This just seems sort of redundant to me, is there a reason? ```csharp ClassName objectName = new Cl❔ JWT token claims not working anymore after deploying application to Azure web app.The code that is working inside a controller locally but not working when deployed on azure Attempt✅ Dapper InsertAsync fails on Postgres with relation does not existHello, I am currently trying to run Dapper CRUD operations (Dapper.Contrib.Extensions) on a database❔ Key press on ButtonI want to make a tool where you press a button so that a key is pressed❔ How bad is this Linq code?```csharp if (getBeginningContent == false) dynContentList = await _context.DynamicContents ❔ Please Help! When I flip my character he moves backwardsHey guys... so I have a problem with my player controller... when I flip it to the other direction m✅ Source Generator, dynamic assembly not added.I have the following code: ```cs var assemblyName = new AssemblyName("MyAssembly"); ✅ EFCore Nullability and Circular ReferencesI have 2 tables which have FK's to each other due to the relationship. I'm trying to add some seed Is there a concurrent ordered collection?And if there isn't, how would you find a workaround for a bunch of threads generating some data and ❔ Helpis it okay to define the set function of a property as public but add it a statement that checks tha❔ NLua csharp hooksHi. Im using `NLua` to embed `Lua` in my project. Rn i can replace default `print` method to use ho❔ class library project wont find resourcesi have an console app in c sharp with this method of loading resources, it works fine but in class l❔ Visual Studio 2022 ErrorIn Visual Studio 2022 I'm trying to make a script but it says the word 'Module' is not found in the✅ Ordering IQueryable by the indexes of another list```cs List<int> savedPostIds = await _db.SavedPosts .Where(a => a.account.us❔ ✅ error CS0150 A constant value is expected```cs using MoreLinq; string[] cards = {"rock", "paper", "scissors"}; Dictionary<string, string> ❔ Unable to change font in VS 2019Hello, i have persisting problem in my c# project made in VS 2019. I made a custom class that is supHow to use use ReadKey in a Task when i'm using ReadKey elsewhere to stop the program from exiting?I start a Task and then use Console.ReadKey to stop the program from exiting. I want to use ReadKey Swagger Doc failedWhat's wrong with it? ```cs <Target Name="PostBuild" AfterTargets="PostBuildEvent"> <Exec Comma