Skip to content

Instantly share code, notes, and snippets.

@speps
Created August 2, 2012 22:08
Show Gist options
  • Save speps/3241118 to your computer and use it in GitHub Desktop.
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
// 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