C#中 Point 是值类型,还是引用类型?

jt638250 2006-06-17 08:29:59
C#中 Point 是值类型,还是引用类型?
...全文
1194 22 打赏 收藏 转发到动态 举报
写回复
用AI写文章
22 条回复
切换为时间正序
请发表友善的回复…
发表回复
Jackie 2006-07-13
  • 打赏
  • 举报
回复
权威:值类型
www_123du_com 2006-07-13
  • 打赏
  • 举报
回复
struct都是值类型

参看MSDN吧。

代码证明:
Point x1 = new Point(1,1);
Point x2 = x1;
bool bl = Point.ReferenceEquals(x1,x2); //bl 等于 false
sandsboy 2006-07-13
  • 打赏
  • 举报
回复
Point是个结构,当然属于值类型
eliphe 2006-07-13
  • 打赏
  • 举报
回复
Point 是结构吧,值类型
zhgroup 2006-07-13
  • 打赏
  • 举报
回复
System.Object
System.ValueType
System.Drawing.Point
值类型
robot2005 2006-07-13
  • 打赏
  • 举报
回复
结构.当然是值了!值类型
jessonyang 2006-07-13
  • 打赏
  • 举报
回复
晕了楼上的
Point 的声明是~~~~
[Serializable, StructLayout(LayoutKind.Sequential), TypeConverter(typeof(PointConverter)), ComVisible(true)]
public struct Point
{ ... }
Point 就是一个 struct
而 .Net 中对于struct 的说明你可以去查查 MSND
无可置疑的 Point 就是值类型
也没有什么好讨论的哈
jt638250 2006-07-13
  • 打赏
  • 举报
回复
看的头都晕了,还是没明白,说是值类型的兄弟,说说为什么不是引用类型,它的哪些特性可以证明他是值类型,而不是引用类型?
liujiwe79 2006-07-03
  • 打赏
  • 举报
回复
值类型
qiekong 2006-07-03
  • 打赏
  • 举报
回复
你看一下.net的工具介绍,一个工具可以看到,
piont是结构(struct)类型,是值类型数据
yuchang1980 2006-07-03
  • 打赏
  • 举报
回复
值类型
  • 打赏
  • 举报
回复
struct是值类型
Samen168 2006-07-03
  • 打赏
  • 举报
回复
下面是2.0里 Point的定义,看看就知道了

[Serializable, StructLayout(LayoutKind.Sequential), TypeConverter(typeof(PointConverter)), ComVisible(true)]
public struct Point
{
public static readonly Point Empty;
private int x;
private int y;
public Point(int x, int y);
public Point(Size sz);
public Point(int dw);
[Browsable(false)]
public bool IsEmpty { get; }
public int X { get; set; }
public int Y { get; set; }
public static implicit operator PointF(Point p);
public static explicit operator Size(Point p);
public static Point operator +(Point pt, Size sz);
public static Point operator -(Point pt, Size sz);
public static bool operator ==(Point left, Point right);
public static bool operator !=(Point left, Point right);
public static Point Add(Point pt, Size sz);
public static Point Subtract(Point pt, Size sz);
public static Point Ceiling(PointF value);
public static Point Truncate(PointF value);
public static Point Round(PointF value);
public override bool Equals(object obj);
public override int GetHashCode();
public void Offset(int dx, int dy);
public void Offset(Point p);
public override string ToString();
private static int HIWORD(int n);
private static int LOWORD(int n);
static Point();
}

Samen168 2006-07-03
  • 打赏
  • 举报
回复
完了,这都有不同答案,呵呵
g555 2006-07-03
  • 打赏
  • 举报
回复
C#高级编程里面讲 它是值类型
jt638250 2006-07-03
  • 打赏
  • 举报
回复
到底是什么类型啊?
aSalt 2006-06-18
  • 打赏
  • 举报
回复
Point 好象是结构吧,值类型
vosov 2006-06-18
  • 打赏
  • 举报
回复
当然是值类型。。。
foyuan 2006-06-18
  • 打赏
  • 举报
回复
结构类型也是应用类型么?
amandag 2006-06-17
  • 打赏
  • 举报
回复
对象类型都是引用类型
加载更多回复(2)

110,546

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 C#
社区管理员
  • C#
  • Web++
  • by_封爱
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告

让您成为最强悍的C#开发者

试试用AI创作助手写篇文章吧