Static Confusion Method

I work with Asp.NET, and I have a class with a name PathFinderthat has methods of the type StyleBarPath(string BrandId,string ProductId)that returns, for example, a combination of the path, including brandIdand productId, and also has such methods in the same class.

What I'm going to do so that the methods staticcan easily call them in every place, saying PathFinder.StylePath("1","2");, to use the return values ​​inside the user control <a href=""></a>.

But since I work too much these days, what I know is getting complicated for a number of reasons. Anyway, here is my question:

Since I use inline coding in many places, such as <a href='<%=PathFinder.StylePath("1","2")%>'></a>, I don’t want to create many instances by doing this <a href='<%=new PathFinder().StylePath("1","2")%>'></a>by declaring methods non-static.

But I'm afraid to change the methods returns values, because the definition of methods is static. I mean, when the client calls this method, it will not affect other clients that simultaneously refer to the same method?

Would they have different call stacks?

Let's say:

  • the client calls a method with these parameters - {brandId:2,productId:3}
  • the client tug calls a method with these parameters - {brandId:3,productId:4}

These actions occur around the same time that the server processes its requests. What I want to know about whether calls affect each other and change the return values ​​of each other, because they are defined as static.

Thanks for reading so far and am an assistant :)

I just don't want customers to see path/1/2/while they waitpath/2/3/

Some notes on the subject:

  • Same for static fields?
+3
3

, :

  • , .
  • , .

, , - . .

. . , .

+7

# ( ) . , .

, , , , call-1 call-2.

, , .

, , . !

+1

Source: https://habr.com/ru/post/1770783/


All Articles