這是我的問題:崩潰控制檯應用程序
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