Created
August 2, 2012 22:08
-
-
Save speps/3241118 to your computer and use it in GitHub Desktop.
FudgeVB - simple C# file and instructions to use VB libraries in Unity3D projects
This file contains 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
// GOAL: To remove dependency on Microsoft.VisualBasic in VB.NET libs... (eg. to use them in Unity3D) | |
// Place this file in a separate C# project and reference it from the VB project | |
// In the .vbproj file add | |
// <NoVBRuntimeReference>true</NoVBRuntimeReference> | |
// in the first <PropertyGroup> (the one without a condition at the beginning) | |
// This implies a ton of fixes to apply to replace things like string compare etc. | |
// Non-exhaustive list of fixes : | |
// - auto conversions are not done (use .ToString() for example) | |
// - use DirectCast(obj, Integer) instead of CInt(obj) | |
// - Sync Lock does not seem to compile, remove it if you don't need thread safety | |
// ** Please fork this and complete with missing functions below :) ** | |
namespace FudgeVB | |
{ | |
public static class SillyThings | |
{ | |
public static T IIf<T>(bool condition, T trueValue, T falseValue) | |
{ | |
return condition ? trueValue : falseValue; | |
} | |
public static char Chr(int n) | |
{ | |
return (char)n; | |
} | |
public static char ChrW(int n) | |
{ | |
return (char)n; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment