Loading components on startup, with timing measurements I was just wondering, is there a way to load these better and log the times they each took? It seems like a headache having to write about 90+ stopwatches, which is what I will have to do as I have about 100 of these to load.

// PacketManager
var packetManagerStopwatch = Stopwatch.StartNew();
_packetManager = new PacketManager();
packetManagerStopwatch.Stop();
Logger.Trace("Loaded PacketManager [took " + packetManagerStopwatch.ElapsedMilliseconds + "ms]");

// Achievements 
var achievementStopwatch = Stopwatch.StartNew();
_achievementManager = new AchievementManager();
achievementStopwatch.Stop();
Logger.Trace("Loaded Achievements [took " + achievementStopwatch.ElapsedMilliseconds + "ms]");

// Talents
var talentsStopwatch = Stopwatch.StartNew();
_talentTrackManager = new TalentTrackManager();
talentsStopwatch.Stop();
Logger.Trace("Loaded Talents [took " + talentsStopwatch.ElapsedMilliseconds + "ms]");

// Badges
var badgeStopwatch = Stopwatch.StartNew();
_badgeManager = new BadgeManager();
badgeStopwatch.Stop();
Logger.Trace("Loaded Badges [took " + badgeStopwatch.ElapsedMilliseconds + "ms]");

// ClientManager
var clientManagerStopwatch = Stopwatch.StartNew();
_clientManager = new GameClientManager();
clientManagerStopwatch.Stop();
Logger.Trace("Loaded GameClientManager [took " + clientManagerStopwatch.ElapsedMilliseconds + "ms]");

// ModerationManager
var moderationManagerStopwatch = Stopwatch.StartNew();
_moderationManager = new ModerationManager();
moderationManagerStopwatch.Stop();
Logger.Trace("Loaded ModerationManager [took " + moderationManagerStopwatch.ElapsedMilliseconds + "ms]");

// ItemDataManager
var itemManagerStopwatch = Stopwatch.StartNew();
_itemDataManager = new ItemDataManager();
itemManagerStopwatch.Stop();
Logger.Trace("Loaded ItemDataManager [took " + itemManagerStopwatch.ElapsedMilliseconds + "ms]");
You need a generic method like this:

static T createInstanceOf&lt;T&gt;() where T : new() {
  var stopwatch = Stopwatch.StartNew();
  T result = new T();
  stopwatch.Stop();
  Logger.Trace("Loaded "+ result.GetType().Name +" [took " + packetManagerStopwatch.ElapsedMilliseconds + "ms]");
  return result;
}


Now you can simply use it like this:

_packetManager = createInstanceOf&lt;PacketManager&gt;();
_achievementManager = createInstanceOf&lt;AchievementManager&gt;();
_talentTrackManager = createInstanceOf&lt;TalentTrackManager&gt;();
_badgeManager = createInstanceOf&lt;BadgeManager&gt;();
// and so on...