-3

i want like PHP summary codes in one files and repeat other pages c# . for ex in PHP :

include 'filename'; or require 'filename';

thanks!

  • What are you trying to do is extremely non-idiomatic. Instead, just make your "pages" a proper functions and call to them. – arrowd Sep 05 '21 at 06:54
  • 1
    @arrowd could you please [edit] the question since you seem to understand what OP is trying to achieve? – Alexei Levenkov Sep 05 '21 at 07:01
  • so you're trying to use c# like if it were php. i don't think that's a wise move. it's like using a hacksaw as if it were a drill - you _may_ succeed with a decent amount of tinkering, but you won't be happy with the result. – Franz Gleichmann Sep 05 '21 at 09:05
  • thanks my friends. I work in a programming company ..Which has many tables for Repository. Which causes congestion and increased page load. So with my previous knowledge of PHP, I wanted to optimize and summarize the pages. any way thanks. – Hossein kalantari Sep 06 '21 at 04:06

1 Answers1

1

there is no such in c# , but you can create class and write method contain on code that need to repeat . example :

class MyClass
{
    //constructor
    public MyClass()
    {

    }
    public void func()
    {
        //code that repeat here 
    }
}

then declare instance from this class and call function