About 4,560,000 results
Open links in new tab
  1. Run function on creation of class instance C# - Stack Overflow

    Jan 30, 2017 · I have a pice of initialiser code that should run when a new instance of a class is created, without having to be called. How would I do that ? Update: class Pice { public int …

  2. c# - Call a method from another class - Stack Overflow

    Mar 18, 2014 · Yes you can. The first way is to make your class to be static. public static class Fooclass { // I don't know the return type of your CallMethod, so I used the void one. public …

  3. c# - How to dynamically call a class' method in .NET? - Stack Overflow

    Jul 13, 2009 · Here is a simple example: static void Main() caller("Foo", "Bar"); static void caller(String myclass, String mymethod) // Get a type from the string . Type type = …

  4. Dynamically Invoking C# Methods - Medium

    Jun 14, 2020 · Using reflection to find and invoke methods at runtime is simple in C#. This article provides a basic example to get going and some common pitfalls to look out for. Let’s get started!

  5. How to: Define and Execute Dynamic Methods - .NET

    The following procedures show how to define and execute a simple dynamic method and a dynamic method bound to an instance of a class. For more information on dynamic methods, …

  6. Call a method from a class to another C# - Microsoft Q&A

    Apr 3, 2021 · You can also use the instance of the class to call the public methods of other classes from another class. For example, the method FindMax belongs to the …

  7. Dynamically Call a Function in C# - C# Corner

    May 15, 2024 · In this article, we will learn how to dynamically call a function in C# using reflection and delegates. By leveraging reflection, you can discover and invoke methods at runtime …

  8. Classes and objects tutorial - C# | Microsoft Learn

    Mar 19, 2025 · In this tutorial, you'll build a console application and see the basic object-oriented features that are part of the C# language. Prerequisites. The latest .NET SDK; Visual Studio …

  9. Calling method or function (C#) - completecsharptutorial.com

    How to implement method or function in programming? After creating function, you need to call it in Main() method to execute. In order to call method, you need to create object of containing …

  10. c# - Calling a method from within a Class - Stack Overflow

    Jun 21, 2014 · namespace Test1 { class Class1 { Test1.Form2 f2; public void DoSomethingWithText() { f2.richTextBox1.Text = "Blah blah blah"; } } } How can I call this …

  11. Some results have been removed
Refresh