本文介绍了不满足条件时返回值.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我应该怎么做?
我正在计算向量和平面之间的交点.
返回值是Vector3D.
找到交点Vector3D是使用相应的交点坐标创建的,并返回到主函数.
但是我不知道当找不到交点时我应该返回什么. Vector3D.null不起作用.返回空"值的正确方法是什么?或未定义" Vector3D吗?
Sander.
How should I do this ?
I am calculating the intersection between a vector and a plane.
the return value is a Vector3D.
when an intersection is found the Vector3D is created with the corresponding intersection coordinates and returned to the main function.
But I don't know what I should return when no intersection is found. Vector3D.null doesn't work. What is the correct way of returning an "empty" or "undefined" Vector3D ?
Sander.
推荐答案
public Object MyMethod()
{
return null;
}
这篇关于不满足条件时返回值.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!