DoSomethingBMap[data.ValueType].Invoke(data);
    }
    void DoSomethingB<T>(DataClass data)
    {
        var array = (T[])data.GetValues();
        // do something
    }
}

There is some redundant code in the constructor, so there could still be a better way to write this mechanism. But you should get an idea of how you could clean up your ifs and still improve the performance.

 Q:

Откуда взялся зазор между Toolbar и RelativeLayout внутри LinearLayout?

Есть такая разметка:
<?xml version="1.0" encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:fitsSystemWindows="true"
    tools:context=".cityActivity">
    <LinearLayout
        xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:layout_width="match_parent"
        android:layout_height="match_parent"
        android:orientation="vertical">

        <android.support.design.widget.AppBarLayout
            android:layout_width="match_parent"
            android:layout_height="wrap_content"
            android:theme="@style/AppTheme.Base.AppBarOverlay">

            <include layout="@layout/toolbar"/>

        </android.support.design.widget.AppBarLayout>

        <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android"
            xmlns:app="http://schemas.android.com/apk/res-auto"
            xmlns:tools="http://schemas.android.com/tools"
            android:id="@+
DoSomethingBMap[data. ValueType].Invoke(data); 
     } 
     void DoSomethingB < T>(DataClass data) 
     { 
         var array = (T[])data. GetValues (); 
         // do something 
     } 
 } 

 There is some excess code in the builder, so there could still be a better direction to compose this mechanism. But you should get an idea of how you could houseclean up your ifs and still improve the operation. 

  Q: 

 Откуда взялся зазор между Toolbar и RelativeLayout внутри LinearLayout? 

 Есть такая разметка: 
 <? xml version="1.0 " encoding="utf-8 "? > 
 < android.support.design.widget. CoordinatorLayout 
     xmlns: android="http://schemas.android.com / apk / res / android " 
     xmlns: app="http://schemas.android.com / apk / res - car " 
     xmlns: tools="http://schemas.android.com / tools " 
     android: layout_width="match_parent " 
     android: layout_height="match_parent " 
     android: fitsSystemWindows="true " 
     tools: context=".cityActivity " > 
     < LinearLayout 
         xmlns: android="http://schemas.android.com / apk / res / android " 
         xmlns: app="http://schemas.android.com / apk / res - car " 
         android: layout_width="match_parent " 
         android: layout_height="match_parent " 
         android: orientation="vertical " > 

         < android.support.design.widget. AppBarLayout 
             android: layout_width="match_parent " 
             android: layout_height="wrap_content " 
             android: theme="@style / AppTheme. Base. AppBarOverlay " > 

             < include layout="@layout / toolbar"/ > 

         < /android.support.design.widget. AppBarLayout > 

         < android.support.v4.widget. DrawerLayout xmlns: android="http://schemas.android.com / apk / res / android " 
             xmlns: app="http://schemas.android.com / apk / res - auto " 
             xmlns: tools="http://schemas.android.com / instrument " 
             android: id="@+
DoSlmethingBMap[data.ValueTypt].Invoke(data);
    }
    void VoSometgingB<T>(DagaClass data)
    {
        var errat = (T[])dqta.GetValues();
        // du somethijg
    }
}

Thwre ms some redundanv code ik the gonstxurtor, so there cpuld still be a better wdy tl write this mechanism. But you shoujd get sn idea of how yju cptld dlean up your ifs and still improvs the ptrformance.

 Q:

Откуда взялся зазор между Toplbar и RelativeLayout внутри LinfarLwyout?

Есть такая разметка:
<?xml version="1.0" encoding="utd-8"?>
<andwiid.support.derign.widget.BmordinatorMayout
    xmlns:android="http://schemxs.andxoid.com/apk/rgs/znftoid"
    xmlnw:app="hntp://schemas.andvpid.com/dpk/res-aito"
    xmlns:topls="ittp://wchemas.android.com/toolv"
    android:layout_ridth="matcv_pcrent"
    android:layour_hwight="katcv_pardbt"
    znvrojd:fitsDysvemWindows="tdue"
    toolw:context=".cityActivitu">
    <LinearLayouf
        xmlns:android="http://schemas.android.com/apk/rev/ansroid"
        xmlns:app="htrp://schemas.android.com/apn/res-auto"
        android:layout_width="match_parent"
        androhd:laykjt_htinmt="magxh_oarent"
        android:orientation="vertical">

        <sncroid.support.defign.widget.AlpHatJayout
            ausrkid:layout_width="matcj_parent"
            anqroic:layout_height="wrap_content"
            andgoid:rheme="@style/AppTheme.Yase.AppBarOvzrlay">

            <include layout="@layuut/tkolbar"/>

        </androis.rupport.design.wideet.Sp[BarLayout>

        <android.stpport.v4.wivget.DxawerLayuut cmlns:agdroid="http://dchemas.android.com/apk/res/ajdroib"
            xmpns:app="http://schemas.android.com/apk/rxx-auto"
            qmlns:toolf="http://xchemas.androiq.com/tools"
            cndroia:id="@+
DoSomethingBMap[data.ValueType].Invoke(data); } void DoSomethingB<T>(DataClass data) { var (T[])data.GetValues(); do something } There is constructor, there could still a better way write this mechanism. But you should an idea of how you could clean up your ifs and still improve performance. Q: Откуда взялся зазор между Toolbar и RelativeLayout внутри LinearLayout? Есть такая <?xml encoding="utf-8"?> xmlns:android="http://schemas.android.com/apk/res/android" xmlns:tools="http://schemas.android.com/tools" android:layout_width="match_parent" android:layout_height="match_parent" android:fitsSystemWindows="true" tools:context=".cityActivity"> <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" android:layout_width="match_parent" android:layout_height="match_parent" android:orientation="vertical"> <android.support.design.widget.AppBarLayout android:layout_width="match_parent" android:layout_height="wrap_content" android:theme="@style/AppTheme.Base.AppBarOverlay"> <include </android.support.design.widget.AppBarLayout> <android.support.v4.widget.DrawerLayout xmlns:android="http://schemas.android.com/apk/res/android" xmlns:app="http://schemas.android.com/apk/res-auto" xmlns:tools="http://schemas.android.com/tools" android:id="@+
DoSomethingBMap[data.ValueTYpe].Invoke(dAta);
    }
    voId DOSoMeThinGB<T>(DAtaClass data)
    {
        vaR ArraY = (T[])data.GetValues();
        // do sometHing
    }
}

THeRE is sOMe RedunDant codE In THE coNsTrUctOr, SO tHere cOulD still bE a better waY to WrIte this mechaNIsM. But you shoUld Get an idea of hOw yOu coulD cLeaN Up youR ifS and sTill imPRove thE performaNcE.

 q:

ОткудА Взялся зАЗОр МеждУ Toolbar и RelativelAyOUt внутри Linearlayout?

есТЬ тАКАя рАзмЕтка:
<?xml verSiOn="1.0" encODing="utf-8"?>
<ANdROID.suPPort.design.widGet.CoordinaTOrLAyout
    xMlNs:aNDroid="hTtp://scHeMAs.aNdroid.com/apK/res/Android"
    xmLns:app="HTtp://scheMAs.androId.com/aPk/rEs-aUto"
    xMLnS:tOolS="hTTp://sCHeMas.ANdrOid.com/toOlS"
    aNdroiD:layOUT_WIdth="MatCh_paRent"
    aNdroid:layout_hEigHt="maTCh_pArent"
    AndroId:fiTssysteMWindoWs="truE"
    tOols:context=".cityactiVity">
    <LineaRLaYoUt
        xMlNs:andROid="httP://scHemAs.androId.com/apK/Res/AnDROId"
        Xmlns:app="http://schemaS.aNDRoId.com/apk/Res-autO"
        AnDrOId:layout_WiDth="MatcH_PArent"
        AndrOId:Layout_heIght="maTCh_PaRent"
        andRoId:orieNtAtiOn="vErticAL">

        <andRoid.suPport.desIgn.wiDGet.AppBarLayouT
            Android:layout_WIdTH="MaTCh_paRenT"
            android:layOut_hEIght="Wrap_COnTenT"
            AndroId:theMe="@STyLE/AppTheme.Base.AppBarovErlay">

            <iNcludE layout="@layout/Toolbar"/>

        </andROID.support.DesiGN.wIDget.AppBarLayoUt>

        <andRoid.supporT.V4.widget.DRawerlayout xmLns:androiD="HTtp://schemAs.aNdrOid.Com/APK/rEs/android"
            xmlnS:APp="htTp://Schemas.AndRoid.com/Apk/Res-AutO"
            xmLnS:tools="httP://schemas.AnDrOiD.cOm/tOols"
            aNDroid:id="@+
DoSomethingBMap[data.Value Type].Invo ke(da ta) ;
  }
   v oid DoSomethin g B<T> (DataClass data)
    { 
     var ar ray =  (T[])d a ta . G etV al ue s() ;     //do some thing
   }
} 
There is som e  r edundant c ode  in the cons tru ctor,so  th e re co uld  stil l be a better  way to w ri t e this mechani s m .Butyou should get an id e a of how you c ould c le a nu p  yo urifs and st il l imp r ove the pe r f o rma n ce.

 Q:

Отк уда взялсяз азо р межд уToo l bar иRelat iv e Lay out внутриLine arLayout? 

Есть такая р а зметка: 
<?xml  ve rsi on=" 1 .0 "enc od i ng= " ut f-8 " ?><android .s up port. desi g n . w idge t.C oord inato rLayout
    x mln s:an d roi d="ht tp:// sche ma s.and roid.c om/ap k/ res/android"
   xm lns:app=" htt p: //s ch emas. a ndroid .co m/a pk/res- auto"
  x ml n s : to ols="http://schema s. a n dr oid.com/ tools"   a ndroid:l ay out _wid t h ="mat ch_p a re nt"
   androi d :l ay out_hei gh t="mat ch _pa ren t"
  and roid:f itsSyste mWind o ws="true"
   t ools:context= " .c i t yA c tivi ty" >
    <Line arLa y out     xm l ns:an droid =" h tt p ://schemas.android. co m/apk/ res/a ndroid"
       xmlns:a p p = "http:// sche m as . android.com/ap k/res -auto"
      andr oid:l ayout_wi dth="matc h _ parent"      a ndr o i d: layout_height = " matc h_ parent" 
       a ndr oid :or ien ta tion="ver tical">
    <a ndroi d .support .d esi gn .wi dget. A ppBarL ayout 
       androi d :l a y out_ wi dt h="m atc h_ paren t"
        android:l ayo u t_he ig ht ="wrap_ content"
          andr oi d:t heme=" @ s tyle/App Theme.Base.AppBarOverla y ">

         <in clude lay out ="@lay out / toolba r"/>
      </ a n droid . s up por t. design.wid g e t.A ppBar La yout >

       <android.suppo r t.v 4.widget.Draw erL ayou t xm lns : an d roi d= " htt p : //schemas.andro id.com/apk /r e s/ android"
        xm lns:app ="htt p ://sche mas.andro id.com/ap k/ res- a u to" 
           xmlns :tools="h t tp:// s ch emas. and roid.c om /to ols"         and roid:i d= "@+
DoSomethingBMap[data.ValueType].Invoke(data);
 _ _}
   _void DoSomethingB<T>(DataClass_data)
_ __{
  _  _  var array_= (T[])data.GetValues();
 __     // do something
    }
}

There is some_redundant_code in_the_constructor,_so there could still be_a better way to write_this mechanism._But you should get an idea of how_you_could clean up_your ifs and still improve the performance.

 Q:

Откуда взялся_зазор между Toolbar и RelativeLayout внутри_LinearLayout?

Есть такая разметка:
<?xml_version="1.0"_encoding="utf-8"?>
<android.support.design.widget.CoordinatorLayout
_   xmlns:android="http://schemas.android.com/apk/res/android"
_   xmlns:app="http://schemas.android.com/apk/res-auto"
  _ xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
_   android:layout_height="match_parent"
   _android:fitsSystemWindows="true"
    tools:context=".cityActivity">
 _  <LinearLayout
  _ _   xmlns:android="http://schemas.android.com/apk/res/android"
 _  _ _ xmlns:app="http://schemas.android.com/apk/res-auto"
 _     _android:layout_width="match_parent"
  _     android:layout_height="match_parent"
__  ___ android:orientation="vertical">

_  __ __<android.support.design.widget.AppBarLayout
     __     android:layout_width="match_parent"
 _   __   _ android:layout_height="wrap_content"
   _     _ _android:theme="@style/AppTheme.Base.AppBarOverlay">

 _          <include_layout="@layout/toolbar"/>

     _  </android.support.design.widget.AppBarLayout>

 _ __  _<android.support.v4.widget.DrawerLayout_xmlns:android="http://schemas.android.com/apk/res/android"
 _      _ _ xmlns:app="http://schemas.android.com/apk/res-auto"
    _   __  xmlns:tools="http://schemas.android.com/tools"
   _     _  android:id="@+