Considerations for optimizing replication using immutable

Source: Internet
Author: User

This is Orleans in the case that the serialization check type supports Orleans built-in high-speed serialization, when using immutable<> wrapper and type declarations, there is immutableattribute, the effect is the same. So there is no need to repeat the call to Asimmutable () for a type that has already been added Immutableattribute

Internal Static BOOLIsorleansshallowcopyable ( ThisType T) {            if(t.isprimitive | | t.isenum | | t =typeof(string) || t = =typeof(DateTime) | | t = =typeof(Decimal) | |T==typeof(immutable<>))                return true; if(T.getcustomattributes (typeof(Immutableattribute),false). Length >0)                return true; if(T.isgenerictype && t.getgenerictypedefinition () = =typeof(immutable<>))                return true; if(T.isvaluetype &&!t.isgenerictype &&!)t.isgenerictypedefinition) {                BOOLresult; Lock(shallowcopyablevaluetypes) {if(Shallowcopyablevaluetypes.trygetvalue (T.typehandle, outresult)) returnresult; } result= T.getfields (). All (f =!) ( F.fieldtype = = t) &&f.fieldtype.isorleansshallowcopyable ()); Lock(shallowcopyablevaluetypes) {Shallowcopyablevaluetypes[t.typehandle]=result; }                returnresult; }            return false; }

Considerations for optimizing replication using immutable

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.