本文整理汇总了C#中System.Type类的典型用法代码示例。如果您正苦于以下问题:C# System.Type类的具体用法?C# System.Type怎么用?C# System.Type使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
System.Type类属于命名空间,在下文中一共展示了System.Type类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: EnumConstantNotPresentException
/// <summary>
/// Constructs a new
/// <code>EnumConstantNotPresentException</code>
/// with the current
/// stack trace and a detail message based on the specified enum type and
/// missing constant name.
/// </summary>
/// <param name="enumType">the enum type.</param>
/// <param name="constantName">the missing constant name.</param>
public EnumConstantNotPresentException(System.Type enumType_1, string constantName_1
) : base("enum constant " + enumType_1.FullName + "." + constantName_1 + " is missing"
)
{
this._enumType = enumType_1;
this._constantName = constantName_1;
}
开发者ID:hakeemsm,项目名称:XobotOS,代码行数:16,代码来源:EnumConstantNotPresentException.cs
示例2: Given_an_OdcmClass_Entity_Derived
public Given_an_OdcmClass_Entity_Derived()
{
base.Init(m =>
{
var @namespace = m.Namespaces[0];
var derivedClass = @namespace.Classes.First();
_baseClass = Any.OdcmEntityClass(@namespace);
@namespace.Types.Add(_baseClass);
derivedClass.Base = _baseClass;
if (!_baseClass.Derived.Contains(derivedClass))
{
_baseClass.Derived.Add(derivedClass);
}
});
_baseConcreteType = Proxy.GetClass(_baseClass.Namespace, _baseClass.Name);
_baseConcreteInterface = Proxy.GetInterface(_baseClass.Namespace, "I" + _baseClass.Name);
_baseFetcherType = Proxy.GetClass(_baseClass.Namespace, _baseClass.Name + "Fetcher");
_baseFetcherInterface = Proxy.GetInterface(_baseClass.Namespace, "I" + _baseClass.Name + "Fetcher");
_baseCollectionType = Proxy.GetClass(_baseClass.Namespace, _baseClass.Name + "Collection");
_baseCollectionInterface = Proxy.GetInterface(_baseClass.Namespace, "I" + _baseClass.Name + "Collection");
_toDerivedMethodName = "To" + ConcreteType.Name;
}
开发者ID:iambmelt,项目名称:Vipr,代码行数:29,代码来源:Given_an_OdcmClass_Entity_Derived.cs
示例3: WriteDataContextCtors
protected virtual void WriteDataContextCtors(CodeWriter writer, Database schema, Type contextBaseType, GenerationContext context)
{
// ctor taking a connections tring
WriteDataContextCtor(writer, schema, contextBaseType,
new[] { new ParameterDefinition { Name = "connectionString", Type = typeof(string) } },
new[] { "connectionString" },
new[] { typeof(string) },
context);
// the two constructors below have the same prototype, so they are mutually exclusive
// the base class requires a IVendor
if (!WriteDataContextCtor(writer, schema, contextBaseType,
new[] { new ParameterDefinition { Name = "connection", Type = typeof(IDbConnection) } },
new[] { "connection", writer.GetNewExpression(writer.GetMethodCallExpression(writer.GetLiteralFullType(context.SchemaLoader.Vendor.GetType()))) },
new[] { typeof(IDbConnection), typeof(IVendor) },
context))
{
// OR the base class requires no IVendor
WriteDataContextCtor(writer, schema, contextBaseType,
new[] { new ParameterDefinition { Name = "connection", Type = typeof(IDbConnection) } },
new[] { "connection" },
new[] { typeof(IDbConnection) },
context);
}
// ctor(string, MappingSource)
WriteDataContextCtor(writer, schema, contextBaseType,
new[] {
new ParameterDefinition { Name = "connection", Type = typeof(string) },
new ParameterDefinition { Name = "mappingSource", Type = typeof(MappingSource) },
},
new[] { "connection", "mappingSource" },
new[] { typeof(string), typeof (MappingSource) },
context);
// ctor(IDbConnection, MappingSource)
WriteDataContextCtor(writer, schema, contextBaseType,
new[] {
new ParameterDefinition { Name = "connection", Type = typeof(IDbConnection) },
new ParameterDefinition { Name = "mappingSource", Type = typeof(MappingSource) },
},
new[] { "connection", "mappingSource" },
new[] { typeof(IDbConnection), typeof(MappingSource) },
context);
// just in case you'd like to specify another vendor than the one who helped generating this file
WriteDataContextCtor(writer, schema, contextBaseType,
new[] {
new ParameterDefinition { Name = "connection", Type = typeof(IDbConnection) },
new ParameterDefinition { Name = "vendor", Type = typeof(IVendor) },
},
new[] { "connection", "vendor" },
new[] { typeof(IDbConnection), typeof(IVendor) },
context);
WriteDataContextCtor(writer, schema, contextBaseType,
new[] {
new ParameterDefinition { Name = "connection", Type = typeof(IDbConnection) },
new ParameterDefinition { Name = "mappingSource", Type = typeof(MappingSource) },
new ParameterDefinition { Name = "vendor", Type = typeof(IVendor) },
},
new[] { "connection", "mappingSource", "vendor" },
new[] { typeof(IDbConnection), typeof(MappingSource), typeof(IVendor) },
context);
}
开发者ID:nlhepler,项目名称:mono,代码行数:60,代码来源:CodeGenerator.Context.Ctor.cs
示例4: LuceneWork
protected LuceneWork(object id, string idInString, System.Type entityClass, Document document)
{
this.id = id;
this.idInString = idInString;
this.entityClass = entityClass;
this.document = document;
}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:7,代码来源:LuceneWork.cs
示例5: StartOnGUI
private void StartOnGUI(SerializedProperty property, GUIContent label)
{
_currentProp = property;
_label = label;
_currentKeysProp = _currentProp.FindPropertyRelative("_keys");
_currentValuesProp = _currentProp.FindPropertyRelative("_values");
_currentValuesProp.arraySize = _currentKeysProp.arraySize;
_lst = CachedReorderableList.GetListDrawer(_currentKeysProp, _lst_DrawHeader, _lst_DrawElement, _lst_OnAdd, _lst_OnRemove);
//_lst.draggable = false;
if(this.fieldInfo != null)
{
var attrib = this.fieldInfo.GetCustomAttributes(typeof(VariantCollection.AsPropertyListAttribute), false).FirstOrDefault() as VariantCollection.AsPropertyListAttribute;
_propertyListTargetType = (attrib != null) ? attrib.TargetType : null;
if(attrib != null && attrib.TargetType != null)
{
_propertyListTargetType = attrib.TargetType;
_propertyListMembers = (from m
in DynamicUtil.GetEasilySerializedMembersFromType(_propertyListTargetType, System.Reflection.MemberTypes.Field | System.Reflection.MemberTypes.Property, DynamicMemberAccess.Write)
select m).ToArray();
_propertyListNames = (from m in _propertyListMembers select m.Name).ToArray();
}
}
}
开发者ID:Gege00,项目名称:spacepuppy-unity-framework,代码行数:30,代码来源:VariantCollectionPropertyDrawer.cs
示例6: GetPlugIns
public void GetPlugIns()
{
System.Type[] plugInInterfaces = new System.Type[] {
typeof(PlugInInterface1),
typeof(PlugInInterface2),
typeof(PlugInInterface3)
};
IInfo[] plugIns = Info.GetPlugIns(Assembly.GetExecutingAssembly(),
plugInInterfaces);
List<IInfo> expectedPlugIns = new List<IInfo>();
expectedPlugIns.Add(new Info("PlugIn1A",
typeof(PlugInInterface1),
typeof(PlugIn1A).AssemblyQualifiedName));
expectedPlugIns.Add(new Info("PlugIn1-Blue",
typeof(PlugInInterface1),
typeof(PlugIn1Blue).AssemblyQualifiedName));
expectedPlugIns.Add(new Info("PlugIn2A",
typeof(PlugInInterface2),
typeof(PlugIn2A).AssemblyQualifiedName));
Assert.AreEqual(expectedPlugIns.Count, plugIns.Length);
foreach (IInfo plugIn in plugIns)
AssertPlugInIsExpected(plugIn, expectedPlugIns);
}
开发者ID:LANDIS-II-Foundation,项目名称:Core-Utilities-Library,代码行数:25,代码来源:Info_Test.cs
示例7: OnTaskInspectorGUI
////////////////////////////////////////
///////////GUI AND EDITOR STUFF/////////
////////////////////////////////////////
protected override void OnTaskInspectorGUI()
{
if (!Application.isPlaying && GUILayout.Button("Select Field")){
System.Action<FieldInfo> FieldSelected = (field)=> {
targetType = field.DeclaringType;
fieldName = field.Name;
checkValue = BBParameter.CreateInstance(field.FieldType, blackboard);
comparison = CompareMethod.EqualTo;
};
if (agent != null){
EditorUtils.ShowGameObjectFieldSelectionMenu(agent.gameObject, typeof(object), FieldSelected);
} else {
var menu = new UnityEditor.GenericMenu();
foreach (var t in UserTypePrefs.GetPreferedTypesList(typeof(Component), true))
menu = EditorUtils.GetFieldSelectionMenu(t, typeof(object), FieldSelected, menu);
menu.ShowAsContext();
Event.current.Use();
}
}
if (agentType != null && !string.IsNullOrEmpty(fieldName)){
GUILayout.BeginVertical("box");
UnityEditor.EditorGUILayout.LabelField("Type", agentType.FriendlyName());
UnityEditor.EditorGUILayout.LabelField("Field", fieldName);
GUILayout.EndVertical();
GUI.enabled = checkValue.varType == typeof(float) || checkValue.varType == typeof(int);
comparison = (CompareMethod)UnityEditor.EditorGUILayout.EnumPopup("Comparison", comparison);
GUI.enabled = true;
EditorUtils.BBParameterField("Value", checkValue);
}
}
开发者ID:pangaeastudio,项目名称:vrgame-htc-vive-jam,代码行数:36,代码来源:CheckField.cs
示例8: OnTaskInspectorGUI
////////////////////////////////////////
///////////GUI AND EDITOR STUFF/////////
////////////////////////////////////////
protected override void OnTaskInspectorGUI()
{
if (!Application.isPlaying && GUILayout.Button("Select Field")){
System.Action<FieldInfo> FieldSelected = (field)=>{
targetType = field.DeclaringType;
fieldName = field.Name;
setValue.SetType(field.FieldType);
};
var menu = new UnityEditor.GenericMenu();
if (agent != null){
foreach(var comp in agent.GetComponents(typeof(Component)).Where(c => c.hideFlags == 0) ){
menu = EditorUtils.GetFieldSelectionMenu(comp.GetType(), typeof(object), FieldSelected, menu);
}
menu.AddSeparator("/");
}
foreach (var t in UserTypePrefs.GetPreferedTypesList(typeof(Component), true)){
menu = EditorUtils.GetFieldSelectionMenu(t, typeof(object), FieldSelected, menu);
}
menu.ShowAsContext();
Event.current.Use();
}
if (agentType != null && !string.IsNullOrEmpty(fieldName)){
GUILayout.BeginVertical("box");
UnityEditor.EditorGUILayout.LabelField("Type", agentType.Name);
UnityEditor.EditorGUILayout.LabelField("Field", fieldName);
UnityEditor.EditorGUILayout.LabelField("Field Type", setValue.varType.FriendlyName() );
GUILayout.EndVertical();
EditorUtils.BBParameterField("Set Value", setValue);
}
}
开发者ID:nemish,项目名称:cubematters,代码行数:36,代码来源:SetField.cs
示例9: GraphSerializationData
//Construct
public GraphSerializationData(Graph graph)
{
this.version = SerializationVersion;
this.type = graph.GetType();
this.name = graph.name;
this.comments = graph.graphComments;
this.translation = graph.translation;
this.zoomFactor = graph.zoomFactor;
this.nodes = graph.allNodes;
this.canvasGroups = graph.canvasGroups;
this.localBlackboard = graph.localBlackboard;
var structConnections = new List<Connection>();
for (var i = 0; i < nodes.Count; i++){
if (nodes[i] is ISerializationCallbackReceiver){
(nodes[i] as ISerializationCallbackReceiver).OnBeforeSerialize();
}
for (var j = 0; j < nodes[i].outConnections.Count; j++){
structConnections.Add(nodes[i].outConnections[j]);
}
}
this.connections = structConnections;
this.primeNode = graph.primeNode;
}
开发者ID:nemish,项目名称:cubematters,代码行数:27,代码来源:GraphSerializationData.cs
示例10: GridWithType
//---------------------------------------------------------------------
//!< Create a grid.
protected GridWithType(uint rows,
uint columns,
System.Type dataType)
: base(rows, columns)
{
this.dataType = dataType;
}
开发者ID:LANDIS-II-Foundation,项目名称:Libraries,代码行数:10,代码来源:GridWithType.cs
示例11: AdoColumn
/// <summary>
///
/// </summary>
/// <param name="column"></param>
public AdoColumn(DataColumn column)
{
name = column.ColumnName;
type = column.DataType;
columnSize = column.MaxLength;
isNullable = column.AllowDBNull;
}
开发者ID:Novthirteen,项目名称:sconit_timesseiko,代码行数:11,代码来源:AdoColumn.cs
示例12: SecondaryTableSecondPass
public SecondaryTableSecondPass(EntityBinder entityBinder, IPropertyHolder propertyHolder,
System.Type annotatedClass)
{
this.entityBinder = entityBinder;
this.propertyHolder = propertyHolder;
this.annotatedClass = annotatedClass;
}
开发者ID:hazzik,项目名称:nh-contrib-everything,代码行数:7,代码来源:SecondaryTableSecondPass.cs
示例13: FSMStateMachineLogic
public FSMStateMachineLogic(System.Type stateClass, FSMStateMachine ownerSM, FSMStateMachineLogic parent)
{
m_ChildrenTypes = new List<System.Type>();
m_StateClass = stateClass;
m_OwnerSM = ownerSM;
m_Parent = parent;
}
开发者ID:rcrmn,项目名称:mastervj-unity-minigames,代码行数:7,代码来源:FSMStateMachineLogic.cs
示例14: OnTaskInspectorGUI
////////////////////////////////////////
///////////GUI AND EDITOR STUFF/////////
////////////////////////////////////////
protected override void OnTaskInspectorGUI()
{
if (!Application.isPlaying && GUILayout.Button("Select Field")){
System.Action<FieldInfo> FieldSelected = (field)=> {
targetType = field.DeclaringType;
fieldName = field.Name;
saveAs.SetType(field.FieldType);
};
if (agent != null){
EditorUtils.ShowGameObjectFieldSelectionMenu(agent.gameObject, typeof(object), FieldSelected);
} else {
var menu = new UnityEditor.GenericMenu();
foreach (var t in UserTypePrefs.GetPreferedTypesList(typeof(Component), true))
menu = EditorUtils.GetFieldSelectionMenu(t, typeof(object), FieldSelected, menu);
menu.ShowAsContext();
Event.current.Use();
}
}
if (agentType != null && !string.IsNullOrEmpty(fieldName)){
GUILayout.BeginVertical("box");
UnityEditor.EditorGUILayout.LabelField("Type", agentType.Name);
UnityEditor.EditorGUILayout.LabelField("Field", fieldName);
UnityEditor.EditorGUILayout.LabelField("Field Type", saveAs.varType.FriendlyName() );
GUILayout.EndVertical();
EditorUtils.BBParameterField("Save As", saveAs, true);
}
}
开发者ID:pangaeastudio,项目名称:vrgame-htc-vive-jam,代码行数:33,代码来源:GetField.cs
示例15: FGConsole
static FGConsole()
{
consoleWindowType = typeof(EditorWindow).Assembly.GetType("UnityEditor.ConsoleWindow");
if (consoleWindowType != null)
{
consoleWindowField = consoleWindowType.GetField("ms_ConsoleWindow", BindingFlags.Static | BindingFlags.NonPublic | BindingFlags.Public);
consoleListViewField = consoleWindowType.GetField("m_ListView", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
consoleLVHeightField = consoleWindowType.GetField("ms_LVHeight", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
consoleActiveTextField = consoleWindowType.GetField("m_ActiveText", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
consoleOnGUIMethod = consoleWindowType.GetMethod("OnGUI", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Instance);
}
listViewStateType = typeof(EditorWindow).Assembly.GetType("UnityEditor.ListViewState");
if (listViewStateType != null)
{
listViewStateRowField = listViewStateType.GetField("row", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
}
editorWindowPosField = typeof(EditorWindow).GetField("m_Pos", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
logEntriesType = typeof(EditorWindow).Assembly.GetType("UnityEditorInternal.LogEntries");
if (logEntriesType != null)
{
getEntryMethod = logEntriesType.GetMethod("GetEntryInternal", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
startGettingEntriesMethod = logEntriesType.GetMethod("StartGettingEntries", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
endGettingEntriesMethod = logEntriesType.GetMethod("EndGettingEntries", BindingFlags.Public | BindingFlags.NonPublic | BindingFlags.Static);
}
logEntryType = typeof(EditorWindow).Assembly.GetType("UnityEditorInternal.LogEntry");
if (logEntryType != null)
{
logEntry = System.Activator.CreateInstance(logEntryType);
logEntryFileField = logEntryType.GetField("file", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
logEntryLineField = logEntryType.GetField("line", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
logEntryInstanceIDField = logEntryType.GetField("instanceID", BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public);
}
}
开发者ID:JuanJosePol,项目名称:ggjmallorca2016,代码行数:33,代码来源:FGConsole.cs
示例16: MdaIntropsector
// ------------------------------------------------------------------------
public MdaIntropsector(System.Type clss, IList<MethodRecognizer> methodsRecognizers)
{
this.clss = clss;
this.methodsRecognizers = methodsRecognizers;
runMethodRecognizers();
buildPropMethodsDescriptors();
}
开发者ID:Arnaud-Nauwynck,项目名称:test-dotnet-snippets,代码行数:8,代码来源:MdaIntropsector.cs
示例17: UIWindowInfo
/// <summary>
/// 窗口信息
/// </summary>
/// <param name="key">标识</param>
/// <param name="t">宿主脚本</param>
/// <param name="resName">资源名称,如果resName为null取key.tostring()</param>
/// <param name="wType">窗口类型</param>
/// <param name="wEffect">窗口效果</param>
public UIWindowInfo(UIType key, System.Type t, string resName = "", UIWindowType wType = UIWindowType.ModelType, UIWindowEffect wEffect = UIWindowEffect.Default)
{
Key = key;
Owner = t;
WinType = wType;
WinEffect = wEffect;
mResourceName = resName;
}
开发者ID:tsuixl,项目名称:Frame,代码行数:16,代码来源:UIWindowType.cs
示例18: AnimationWindowHierarchyNode
public AnimationWindowHierarchyNode(int instanceID, int depth, TreeViewItem parent, System.Type animatableObjectType, string propertyName, string path, string displayName)
: base(instanceID, depth, parent, displayName)
{
this.displayName = displayName;
this.animatableObjectType = animatableObjectType;
this.propertyName = propertyName;
this.path = path;
}
开发者ID:BlakeTriana,项目名称:unity-decompiled,代码行数:8,代码来源:AnimationWindowHierarchyNode.cs
示例19:
void IComponentChoiceSelector.BeforeGUI(SelectableComponentPropertyDrawer drawer, SerializedProperty property, System.Type restrictionType)
{
_drawer = drawer;
_property = property;
_restrictionType = restrictionType;
_components = this.DoGetComponents();
this.OnBeforeGUI();
}
开发者ID:Gege00,项目名称:spacepuppy-unity-framework,代码行数:8,代码来源:IComponentChoiceSelector.cs
示例20: ShowDialog
public void ShowDialog(System.Type t, string folder)
{
this.type = t;
this.folder = folder;
gameObject.SetActive (true);
UpdateView ();
}
开发者ID:shinobushiva,项目名称:Unity-DataSaveLoad,代码行数:8,代码来源:LoadDataUI.cs
注:本文中的System.Type类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论