📜 ⬆️ ⬇️

CallSharp Project: I / O Call Instrumentation on .NET

What do I do in all the advanced workflows, so that they are not only helping to solve any problem, but more thoroughly and will be taught to programs by their own tasks, but also by other programs and programs. The tula that I want to transfer is the very name of it. CallSharr - so my project is being initiated - an attempt is being made to expose the call chain on the basis of a test of incoming and outgoing external data.



& quot;  abc & quot;  âź¶ & quot;  cba & quot;

First, a simple example: you have an abc, you must receive a "b" . Above, I have done this chemically, and later in the article I will continue to use the heading.

This example ideally illustrates the problem, because in .NOT at the end of the line is the method of the Rvrs() method, and the solution of this problem is not much. Hee, it is possible to write this way:
')
 new string(input.Reverse().ToArray()) 

Warnings to get to the area, you can get to the mountains. Sounds like a little fantasy, huh?

Let's take a break for the beginning of a simple example:

abcâź¶ABC

In our case, b is an exact struck, and nothing else. Now we will have to ponder what we can do to get .

We have the luck that the lines in the NET are non-muteable, and we do not need to check the changes in the original signal after a call to it - only at the same level. And in addition, we can take and ask for the whole method (and also your own, which is in NET. Also, the method is with the gt_ ), which is


Approximately that "they can not take a single thought" - this is the case of various cases, and


If we follow these criteria, we will get a list of func- tion strings, which would have been unfortunate to call on ABC:

 Normalize ToLower ToLowerInvariant ToUpper ToUpperInvariant ToString Trim TrimStart TrimEnd 

Taking each of these functions, we call on "b" , we look at the result. Only two functions are available:

 input.ToUpper() input.ToUpperInvariant() 

Opa, the first mission is fulfilled!

abcâź¶3

How to understand what is the type of number 3 on the right? I offer this allegorize:


Consistently to this agroitma, the trickle (3) can be the same and the hr and the hr (and also flt or even imSn !), But in the current example, we accept everything one of all of the rest of the world.

Using all the linear line-wise methods by hand, we replace

 input.Length 

IT IS ESTABLISHED, WHICH HAPPENED IT TO call this function gt_Lngth() , but the CARDSHARP will remove all unnecessary decors for personal pleasure.

abcâź¶false

Chitersky example. If I’d take tru , I’ll have IsNormalized IsNrmlizd() , and so on the non-static of the vain not. What else, let us add our algorythm, we’ll be able to rewrite other and more systematic methods


After our search for statistics, we received a couple of controversial results:

 string.IsNullOrEmpty(input) string.IsNullOrWhiteSpace(input) 

Beautiful Give something more already!

abc⎵⎵⟶ABC

Uh, there is a lasting situation - "b " , then there are two problems at the end: this is not a single function to receive. Have to do the call chain. In this case, the chain must not be string → string → string , it can be string → which o oo → string , because Supplemental data is not important to us.

Immediately on this, a combinatorial explosion occurs. Well, what did you want? Then, on our inbound data, we receive many of the baptists:

 string.Concat(input.Split()).ToUpper() string.Concat(input.Split()).ToUpperInvariant() input.ToUpper().Trim() input.ToUpper().TrimEnd() input.ToUpperInvariant().Trim() input.ToUpperInvariant().TrimEnd() input.Trim().ToUpper() input.Trim().ToUpperInvariant() input.TrimEnd().ToUpperInvariant() input.TrimEnd().ToUpper() // + lots more solutions 

I have not become an offensive of decisions, they are quite a lot. See if you have a better understanding, but you need to take care of your problems.

This is not a terrible problem when a call is 2, but when they are 3 or more, an excessive workmanship, which is forced to do a program, all of which is impressive.

aaabbbâź¶aaa

So far we have discussed only “nyashnye” functions that can be called without any means. All over is a thing that will not perish. To remove bbb at the end, you need to call something-that hard either cut it or b or bbb or deletes the last 3 letters in the text.

IS EQUIPPED, that all call experts must be authorized with the object at which the call is made. For this purpose, a terrible and terrible Frgmnttinngin is done - a classroom that is able to crack other types of parts. (There should be a partition of the Disabler from Inertstone.)

Let's take a line bbb . Ee can be edited by:


By embarking a line on extruded objects, we are looking for methods - static or not - who take these objects. Much more than the foregoing, by the exception of what


Cardsharr, of course, is controlled with our synthetic example and gives us

 input.Trim('b') input.TrimEnd('b') 

As you have already come to the knowledge, combinational explosions can mimic a fan of many other co-operatives who, being faithful, are too complex and unnecessary. Bots for example:

caterâź¶cat

Hmm, it would be necessary to just completely r or and r in the distance. If you stop the CallShaRr on this example, we will receive

 input.Trim('e','r') input.Trim('r','e') input.Trim('a','e','r') input.Trim('a','r','e') input.Trim('e','a','r') input.Trim('e','r','a') input.Trim('r','a','e') input.Trim('r','e','a') input.TrimEnd('e','r') input.TrimEnd('r','e') // 30+ more options 

As you see, the first two couples are single, who would be willing to use. All the rest of the excessive information, which does not give anyone any help. Or else

aabbccâź¶aacc

There are fewer men, and here they are:

 input.Replace("aabb", "aa") input.Replace("bb", "") input.Replace("bbcc", "cc") 

The single correct option above is the middle option. Two others were good and were repaired from the point of view of the semantics, all of which were completely unfulfilled.

Another single observation - this is something that other interesting solutions are blunt in depth, and not on turning. Bots Napier

a⎵b⎵c⟶abc

Here you can simply remove the problem, but CallSharr gives many vapors, for example

 input.Replace(" ", string.Empty) input.Replace(" b ", "b") input.Replace("ab ", "ab") input.Replace(" b c", "bc") input.Replace("ab c", "abc") // at greater depth, string.Concat(input.Split()) 

The best options are the first and, possibly, the last ones - he and the next from the point of view of execution (the opposite, the other one, the intuition shows), but it looks like a shadow, which looks like a shadow, This is the best example of this, as the program can display what the person does not see.

Summarizing


Ceychas SallSharr works, say so, lightly. The problem of the basis of the use of reflection (in in particular the in-in services of the in-in-one, in the case of the in-in-service and in the in-in-service of the in-in-service and in the associated explosions associated with the depth of the call and in the depth of the service and in the depth of the challenge and in the depth of the challenge and in the depth of the challenge and in the depth of the challenge,

CURRENT PROBLEMS WITH PERFORMANCE REPAIRS ARE RELEASED WHEN RELEASING FROM DYNAMICALLY UP TO A STANDARD REFLESTIENO (PREPARED TO REMOVE ALL UP TO 4T Optimization can be done by a lot of people - I would like to understand how to set up an annotation for “commutativeness” as a set of functions, such as tools and functions, as a function of “e-technologies”, and a person in a way to make a difference, ”I would like to use

TellSharr - open our project, lies on GitHub . Here we have his releases - by clicking on the link here, the SlcK is set to be distributive, which will be compacted by the release of new versions.

For those who want a little more lively narration, my report on Petersburg .NET User Group is presented below:


Thank you for your attention!

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


All Articles