public
Created

FudgeVB - simple C# file and instructions to use VB libraries in Unity3D projects

  • Download Gist
SillyThings.cs
C#
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
// 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;
}
}
}

Please sign in to comment on this gist.

Something went wrong with that request. Please try again.