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
Post a Comment