Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Static class reference name [duplicate]

Tags:

c#

static

This is mostly just a question of curiosity. I've tried searches like "static class shorthand" or "static class nickname" and the like, and haven't found anything, which leads me to believe it isn't possible.

Let's say there's a static class called TransitionalTransactionDeltaTemporaryRecord. Is there a way in C# to create a shorter-named reference to said class in my code, such that I could use the reference in place of the class? Pseudo-code example below.

staticref DeltaRecord = System.TransitionalTransactionDeltaTemporaryRecord;

Transaction test = new Transaction();

// Ideally, these two would accomplish the same thing
test.Epsilon = DeltaRecord.ComputeEpsilon(pi);
test.Epsilon = TransitionalTransactionDeltaTemporaryRecord.ComputeEpsilon(pi);

I'm hoping to avoid having to use extremely long identifiers, if possible.

like image 881
Travis Avatar asked Dec 09 '25 19:12

Travis


1 Answers

The alias using ShortName = System.TransitionalTransactionDeltaTemporaryRecord; should do it.

like image 109
adjan Avatar answered Dec 11 '25 07:12

adjan



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!