This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class MonoBehaviourExt | |
{ | |
public static IEnumerator DelayedCoroutine(this MonoBehaviour mb, float delay, System.Action a) | |
{ | |
yield return new WaitForSeconds(delay); | |
a(); | |
} | |
public static Coroutine RunDelayed(this MonoBehaviour mb, float delay, System.Action a) | |
{ |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
public static class GenericToStringExts { | |
public static string ToStringExt<T>(this List<T> list) => "[" + string.Join(", ", list) + "]"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public static class GenericToStringExts { | |
public static string ToStringExt<T>(this List<T> list) => "[" + string.Join(", ", list) + "]"; | |
public static string ToStringExt<T>(this List<List<T>> listOfLists) => "[" + string.Join(", ", listOfLists.Select(l => l.ToStringExt())) + "]"; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var strList = new List<string>() {"one", "two", "three"}; | |
Console.WriteLine("ToString: " + strList.ToString()); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var listOfLists = new List<List<string>>() { new List<string>() {"one", "two"}, new List<string>() {"three", "four"}}; | |
Console.WriteLine("ToString: " + listOfLists.ToString()); | |
Console.WriteLine("ToStringExt: " + listOfLists.ToStringExt()); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections; | |
using System.Collections.Generic; | |
using System.Linq; | |
namespace NoSuchStudio.Common | |
{ | |
public static class GenericToStringExts | |
{ | |
// Dictionary's KeyValuePair |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var strList = new List<string>() { | |
"one", "two", "three" | |
}; | |
Console.WriteLine(strList.ToStringExt()); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
class Program | |
{ | |
static void Main(string[] args) | |
{ | |
var listOfLists = new List<List<string>>() { | |
new List<string>() {"one", "two"}, | |
new List<string>() {"three", "four"} | |
}; | |
Console.WriteLine(listOfLists.ToStringExt()); | |
// output: [[one, two], [three, four]] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using System; | |
using System.Collections.Generic; | |
using UnityEngine; | |
namespace NoSuchStudio.Common { | |
/// <summary> | |
/// Base class for MonoBehaviours that should have a separate logger. Useful for filtering | |
/// logs by class types. | |
/// </summary> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using UnityEngine; | |
using NoSuchStudio.Common; | |
public class MyClassB : MonoBehaviour { | |
void Start() { | |
this.LogLog("Hello World!"); | |
} | |
} |