@@ -17,31 +17,17 @@ namespace Csla.Serialization.Mobile
1717 /// </summary>
1818 public static class AssemblyNameTranslator
1919 {
20- private static string ? _coreLibAssembly = null ;
21- private static string CoreLibAssembly
22- {
23- get
24- {
25- if ( _coreLibAssembly == null )
26- {
27- _coreLibAssembly = typeof ( object ) . AssemblyQualifiedName ! ;
28- _coreLibAssembly = _coreLibAssembly . Substring ( _coreLibAssembly . IndexOf ( ", " ) + 2 ) ;
29- }
30- return _coreLibAssembly ;
31- }
32- }
33- private static string ? _cslaLibAssembly = null ;
34- private static string CslaLibAssembly
20+ private static readonly Lazy < string > CoreLibAssemblyLazy = new ( ( ) => GetAssemblyTypeName ( typeof ( object ) ) , LazyThreadSafetyMode . PublicationOnly ) ;
21+ private static string CoreLibAssembly => CoreLibAssemblyLazy . Value ;
22+
23+ private static readonly Lazy < string > CslaLibAssemblyLazy = new ( ( ) => GetAssemblyTypeName ( typeof ( NullPlaceholder ) ) , LazyThreadSafetyMode . PublicationOnly ) ;
24+
25+ private static string CslaLibAssembly => CslaLibAssemblyLazy . Value ;
26+
27+ private static string GetAssemblyTypeName ( Type type )
3528 {
36- get
37- {
38- if ( _cslaLibAssembly == null )
39- {
40- _cslaLibAssembly = typeof ( NullPlaceholder ) . AssemblyQualifiedName ! ;
41- _cslaLibAssembly = _cslaLibAssembly . Substring ( _cslaLibAssembly . IndexOf ( ", " ) + 2 ) ;
42- }
43- return _cslaLibAssembly ;
44- }
29+ var tmp = type . AssemblyQualifiedName ! ;
30+ return tmp [ ( tmp . IndexOf ( ", " , StringComparison . Ordinal ) + 2 ) ..] ;
4531 }
4632
4733 private static readonly string CORELIB = "/n" ;
0 commit comments