我正在使用MonoDevelop 2.4.2 for OS X(Unity 3.4.1附带的版本),并且想知道是否有某种方法可以从基类或属性继承注释.
例:
public class Foo
{
/// <summary>
/// The describes the ABC property
/// </summary>
public virtual int ABC
{
get { return _abc; }
set { _abc = value; }
}
protected int _abc;
/// <summary>
/// The describes the XYZ property
/// </summary>
public virtual int XYZ
{
get { return _xyz; }
set { _xyz = value; }
}
protected int _xyz;
}
public class Bar : Foo
{
public override …
Run Code Online (Sandbox Code Playgroud) 我正在使用C#和Mono的Full AOT技术为iPhone开发.根据他们的限制页面(链接文本),与传统的Mono/.NET不同,iPhone上的代码是提前静态编译的,而不是由JIT编译器按需编译.
在硬件上运行时,会发生以下异常:
ExecutionEngineException: Attempting to JIT compile method 'System.Reflection.MonoProperty:GetterAdapterFrame<Image, UnityEngine.Color> (System.Reflection.MonoProperty/Getter`2<Image, UnityEngine.Color>,object)' while running with --aot-only.
System.Reflection.MonoProperty.GetValue (System.Object obj, System.Object[] index) [0x00000]
Ani+AniValue.Get ()
Ani.CreateAnimations (System.Object obj, System.Collections.Hashtable properties, Single duration, System.Collections.Hashtable options, AniType type)
Ani.Method (AniType type, System.Object obj, Single duration, System.Collections.Hashtable _properties, System.Collections.Hashtable _options)
Ani.From (System.Object obj, Single duration, System.Collections.Hashtable _properties)
xObject+<>c__CompilerGenerated5.MoveNext ()
UnityEngine.MonoBehaviour:StartCoroutine(IEnumerator)
xObject:StartAnimation(Animate, GameObject, Object, Object)
SceneSplash:CreateBackground()
SceneSplash:OnSetup()
SceneSplash:OnSceneActivate(Callback)
GameController:ActivateScene()
GameController:DeactivateScene()
GameController:SceneLoaded(Scene, GameObject, SceneBase)
SceneBase:Start()
Run Code Online (Sandbox Code Playgroud)
根据Limitations文档,不支持System.Reflection.Emit,但它们表示作为Reflection.Emit的一面,"整个Reflection API,包括Type.GetType("someClass"),列出方法,列出属性,获取属性和价值观工作得很好."
我已经包含了导致异常的代码......
void CreateAnimations(System.Object obj, …
Run Code Online (Sandbox Code Playgroud) 我有一个功能,它接收两个值的功率.
我需要将它转换为枚举范围(0,1,2,3等),然后将其转换回两个范围的幂.
0 1
1 2
2 4
3 8
4 16
5 32
6 64
7 128
8 256
9 512
10 1024
... and so on.
Run Code Online (Sandbox Code Playgroud)
如果我的函数接收到1024的值,我需要将其转换为10.在C#中执行此操作的最佳方法是什么?我应该在一个循环中继续除以2并计算迭代次数吗?
我知道我可以用(1 << 10)把它换回来.