这是我的问题:崩溃控制台应用程序
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ConsoleApplication1
{
public abstract class EntityMember<T>
{
public T Value { get; set; }
}
public class Int32EntityMember : EntityMember<int?>
{
}
public class StringEntityMember : EntityMember<string>
{
}
public class GuidEntityMember : EntityMember<Guid?>
{
}
public class Entity
{
public GuidEntityMember ApplicationId { get; private set; }
public Int32EntityMember ConnectedCount { get; private set; }
public GuidEntityMember MainApplicationId { get; private set; }
public Int32EntityMember ProcessId { get; private set; }
public StringEntityMember ProcessName { get; private set; }
}
class Program
{
static void Main(string[] args)
{
Entity entity2 = new Entity();
Guid empty = Guid.NewGuid();
Guid applicationId = Guid.NewGuid();
int Id = 10;
string name = "koko";
entity2.MainApplicationId.Value = new Guid?(empty);
entity2.ApplicationId.Value = new Guid?(applicationId);
entity2.ProcessId.Value = new int?(Id);
entity2.ProcessName.Value = name;
entity2.ConnectedCount.Value = 1;
}
}
}
的应用已完全阻断上线:
entity2.MainApplicationId. Value = new Guid? (empty);
为什么?
什么错误(如果有的话),你看见了什么? – ChrisF 2010-08-26 11:37:12
Koka,欢迎来到stackoverflow =)当你在这里提出问题时,尽可能多地显示相关信息总是很有用,所以你看到的任何异常的内容都是有用的,以及你的代码=)如果我们的答案之一解决了您的问题,请点击答案旁边的勾号大纲以将其标记为“已接受的答案”。确保你这样做会让人更倾向于回答你在这里问的任何未来问题=)(*编辑:我可以看到你刚刚完成了!*) – Rob 2010-08-26 11:47:31