c# - How to remove redundance in text attributes? -


say have piece of code such as:

[myattribute("long long text 1", "some more long text 1")] [myattribute("long long text 2", "some more long text 2")] [myattribute("long long text 3", "some more long text 3")] public class testclass  {    [...] } 

is there way introduce consts substitute common substrings in these attributes (i.e. long long text , some more long text in example) ? understand might not possible in terms of actual 'const' surely there must feature ?

you can use constants:

public class someclass {     public const string someconstant = "long long text 1"; }  [myattribute(someclass.someconstant)] public class someotherclass { } 

you have reference them properly.


Comments

Popular posts from this blog

ios - RestKit 0.20 — CoreData: error: Failed to call designated initializer on NSManagedObject class (again) -

laravel - PDOException in Connector.php line 55: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES) -

java - Digest auth with Spring Security using javaconfig -