当前位置: 首页>>代码示例>>C#>>正文


C# System.GetName方法代码示例

本文整理汇总了C#中System.GetName方法的典型用法代码示例。如果您正苦于以下问题:C# System.GetName方法的具体用法?C# System.GetName怎么用?C# System.GetName使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System的用法示例。


在下文中一共展示了System.GetName方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: EnsureResources

        public static void EnsureResources(System.Reflection.Assembly assembly, string dataPath)
        {
            var contentIdentifier = assembly.GetName().Name + ".Content.";
            var scriptIdentifier = assembly.GetName().Name + ".Scripts.";
            var dataIdentifier = assembly.GetName().Name + ".App_Data.";

            foreach (var resource in assembly.GetManifestResourceNames()) {
                if (resource.StartsWith (contentIdentifier)) {
                    // Treat Content resources as though every "." except the last is a directory separator
                    var path = resource.Substring (contentIdentifier.Length);
                    var lastDot = path.LastIndexOf (".");
                    if (lastDot > -1)
                        path = path.Substring (0, lastDot).Replace ('.', Path.DirectorySeparatorChar) + "." + path.Substring (lastDot + 1);
                    else
                        path = path.Replace('.', Path.DirectorySeparatorChar);
                    path = Path.Combine (dataPath, path);
                    EnsureResource (assembly, path, resource);
                } else if (resource.StartsWith (scriptIdentifier)) {
                    var path = Path.Combine (dataPath, resource.Substring (scriptIdentifier.Length));
                    EnsureResource (assembly, path, resource);
                } else if (resource.StartsWith (dataIdentifier)) {
                    var path = Path.Combine (dataPath, resource.Substring (dataIdentifier.Length));
                    EnsureResource (assembly, path, resource);
                }
            }
        }
开发者ID:MilenPavlov,项目名称:PortableRazorStarterKit,代码行数:26,代码来源:ResourceManager.cs

示例2: TryReadValues

/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
public static void TryReadValues(this CharacterInventoryTable source, System.Data.IDataRecord dataRecord)
{
for (int i = 0; i < dataRecord.FieldCount; i++)
{
switch (dataRecord.GetName(i))
{
case "character_id":
source.CharacterID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(i);
break;


case "item_id":
source.ItemID = (DemoGame.ItemID)(DemoGame.ItemID)dataRecord.GetInt32(i);
break;


case "slot":
source.Slot = (NetGore.InventorySlot)(NetGore.InventorySlot)dataRecord.GetByte(i);
break;


}

}
}
开发者ID:mateuscezar,项目名称:netgore,代码行数:35,代码来源:CharacterInventoryTableDbExtensions.cs

示例3: TryReadValues

/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
public static void TryReadValues(this ShopTable source, System.Data.IDataRecord dataRecord)
{
for (int i = 0; i < dataRecord.FieldCount; i++)
{
switch (dataRecord.GetName(i))
{
case "can_buy":
source.CanBuy = (System.Boolean)(System.Boolean)dataRecord.GetBoolean(i);
break;


case "id":
source.ID = (NetGore.Features.Shops.ShopID)(NetGore.Features.Shops.ShopID)dataRecord.GetUInt16(i);
break;


case "name":
source.Name = (System.String)(System.String)dataRecord.GetString(i);
break;


}

}
}
开发者ID:wtfcolt,项目名称:game,代码行数:35,代码来源:ShopTableDbExtensions.cs

示例4: TryReadValues

/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
public static void TryReadValues(this WorldStatsCountShopBuyTable source, System.Data.IDataRecord dataRecord)
{
for (int i = 0; i < dataRecord.FieldCount; i++)
{
switch (dataRecord.GetName(i))
{
case "count":
source.Count = (System.Int32)(System.Int32)dataRecord.GetInt32(i);
break;


case "last_update":
source.LastUpdate = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i);
break;


case "shop_id":
source.ShopID = (NetGore.Features.Shops.ShopID)(NetGore.Features.Shops.ShopID)dataRecord.GetUInt16(i);
break;


}

}
}
开发者ID:wtfcolt,项目名称:game,代码行数:35,代码来源:WorldStatsCountShopBuyTableDbExtensions.cs

示例5: TryReadValues

/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
public static void TryReadValues(this EventCountersItemTemplateTable source, System.Data.IDataRecord dataRecord)
{
for (int i = 0; i < dataRecord.FieldCount; i++)
{
switch (dataRecord.GetName(i))
{
case "counter":
source.Counter = (System.Int64)(System.Int64)dataRecord.GetInt64(i);
break;


case "item_template_event_counter_id":
source.ItemTemplateEventCounterId = (System.Byte)(System.Byte)dataRecord.GetByte(i);
break;


case "item_template_id":
source.ItemTemplateID = (DemoGame.ItemTemplateID)(DemoGame.ItemTemplateID)dataRecord.GetUInt16(i);
break;


}

}
}
开发者ID:wtfcolt,项目名称:game,代码行数:35,代码来源:EventCountersItemTemplateTableDbExtensions.cs

示例6: TryReadValues

/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
public static void TryReadValues(this EventCountersShopTable source, System.Data.IDataRecord dataRecord)
{
for (int i = 0; i < dataRecord.FieldCount; i++)
{
switch (dataRecord.GetName(i))
{
case "counter":
source.Counter = (System.Int64)(System.Int64)dataRecord.GetInt64(i);
break;


case "shop_event_counter_id":
source.ShopEventCounterId = (System.Byte)(System.Byte)dataRecord.GetByte(i);
break;


case "shop_id":
source.ShopID = (NetGore.Features.Shops.ShopID)(NetGore.Features.Shops.ShopID)dataRecord.GetUInt16(i);
break;


}

}
}
开发者ID:mateuscezar,项目名称:netgore,代码行数:35,代码来源:EventCountersShopTableDbExtensions.cs

示例7: TryReadValues

/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
public static void TryReadValues(this WorldStatsCountItemBuyTable source, System.Data.IDataRecord dataRecord)
{
for (int i = 0; i < dataRecord.FieldCount; i++)
{
switch (dataRecord.GetName(i))
{
case "count":
source.Count = (System.Int32)(System.Int32)dataRecord.GetInt32(i);
break;


case "item_template_id":
source.ItemTemplateID = (DemoGame.ItemTemplateID)(DemoGame.ItemTemplateID)dataRecord.GetUInt16(i);
break;


case "last_update":
source.LastUpdate = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i);
break;


}

}
}
开发者ID:mateuscezar,项目名称:netgore,代码行数:35,代码来源:WorldStatsCountItemBuyTableDbExtensions.cs

示例8: TryReadValues

/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
public static void TryReadValues(this AccountCharacterTable source, System.Data.IDataRecord dataRecord)
{
for (int i = 0; i < dataRecord.FieldCount; i++)
{
switch (dataRecord.GetName(i))
{
case "account_id":
source.AccountID = (DemoGame.AccountID)(DemoGame.AccountID)dataRecord.GetInt32(i);
break;


case "character_id":
source.CharacterID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(i);
break;


case "time_deleted":
source.TimeDeleted = (System.Nullable<System.DateTime>)(System.Nullable<System.DateTime>)(dataRecord.IsDBNull(i) ? (System.Nullable<System.DateTime>)null : dataRecord.GetDateTime(i));
break;


}

}
}
开发者ID:mateuscezar,项目名称:netgore,代码行数:35,代码来源:AccountCharacterTableDbExtensions.cs

示例9: TryReadValues

/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
public static void TryReadValues(this EventCountersUserTable source, System.Data.IDataRecord dataRecord)
{
for (int i = 0; i < dataRecord.FieldCount; i++)
{
switch (dataRecord.GetName(i))
{
case "counter":
source.Counter = (System.Int64)(System.Int64)dataRecord.GetInt64(i);
break;


case "user_event_counter_id":
source.UserEventCounterId = (System.Byte)(System.Byte)dataRecord.GetByte(i);
break;


case "user_id":
source.UserID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(i);
break;


}

}
}
开发者ID:mateuscezar,项目名称:netgore,代码行数:35,代码来源:EventCountersUserTableDbExtensions.cs

示例10: buildTreeFromAssembly

        public void buildTreeFromAssembly(System.Reflection.Assembly CurrentAsm)
        {
            //code from Platt's example
            TreeNode BaseNode;
            BaseNode = treeViewAssembly.Nodes.Add("Assy:" + CurrentAsm.GetName().ToString());
            BaseNode.Tag = CurrentAsm;

            // Enumerate each type contained in the assembly

            foreach (System.Type ThisType in CurrentAsm.GetTypes())
            {
                TreeNode MyNode;
                MyNode = BaseNode.Nodes.Add(ThisType.ToString() + " : " + ThisType.BaseType.ToString());
                MyNode.Tag = ThisType;

                // Enumerate all the members of this type
                // Add each member to the tree

                foreach (System.Reflection.MemberInfo Member in
                    ThisType.GetMembers(System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.Static))
                {
                    TreeNode typenode = MyNode.Nodes.Add(Member.MemberType.ToString() + " : " + Member.Name);
                    typenode.Tag = Member;
                }
            }
        }
开发者ID:dust2098,项目名称:e33-dispatcher-application,代码行数:26,代码来源:frmTreeAndTestCases.cs

示例11: TryReadValues

/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
public static void TryReadValues(this CharacterSkillTable source, System.Data.IDataRecord dataRecord)
{
for (int i = 0; i < dataRecord.FieldCount; i++)
{
switch (dataRecord.GetName(i))
{
case "character_id":
source.CharacterID = (DemoGame.CharacterID)(DemoGame.CharacterID)dataRecord.GetInt32(i);
break;


case "skill_id":
source.SkillID = (DemoGame.SkillType)(DemoGame.SkillType)dataRecord.GetByte(i);
break;


case "time_added":
source.TimeAdded = (System.DateTime)(System.DateTime)dataRecord.GetDateTime(i);
break;


}

}
}
开发者ID:mateuscezar,项目名称:netgore,代码行数:35,代码来源:CharacterSkillTableDbExtensions.cs

示例12: TryReadValues

/// <summary>
/// Reads the values from an <see cref="IDataReader"/> and assigns the read values to this
/// object's properties. Unlike ReadValues(), this method not only doesn't require
/// all values to be in the <see cref="IDataReader"/>, but also does not require the values in
/// the <see cref="IDataReader"/> to be a defined field for the table this class represents.
/// Because of this, you need to be careful when using this method because values
/// can easily be skipped without any indication.
/// </summary>
/// <param name="source">The object to add the extension method to.</param>
/// <param name="dataRecord">The <see cref="IDataReader"/> to read the values from. Must already be ready to be read from.</param>
public static void TryReadValues(this QuestRequireStartItemTable source, System.Data.IDataRecord dataRecord)
{
for (int i = 0; i < dataRecord.FieldCount; i++)
{
switch (dataRecord.GetName(i))
{
case "amount":
source.Amount = (System.Byte)(System.Byte)dataRecord.GetByte(i);
break;


case "item_template_id":
source.ItemTemplateID = (DemoGame.ItemTemplateID)(DemoGame.ItemTemplateID)dataRecord.GetUInt16(i);
break;


case "quest_id":
source.QuestID = (NetGore.Features.Quests.QuestID)(NetGore.Features.Quests.QuestID)dataRecord.GetUInt16(i);
break;


}

}
}
开发者ID:wtfcolt,项目名称:game,代码行数:35,代码来源:QuestRequireStartItemTableDbExtensions.cs

示例13: GetVersion

        ///<summary>
        ///Version info.
        ///</summary>
        /// <param name="assembly">Assembly</param>
        /// <remarks><para>Version of this assembly.</para>
        /// <para>0.0.0.0 if wrong.</para></remarks>
        public static Version GetVersion(System.Reflection.Assembly assembly) {
            if (assembly != null) {
                Version version = assembly.GetName().Version;
                if (version != null) {
                    return version;
                }
            }
			return new Version(0, 0, 0, 0);
		}
开发者ID:divyang4481,项目名称:lextudio,代码行数:15,代码来源:AssemblyHelper.cs

示例14: FormatApplicationName

 private string FormatApplicationName(System.Reflection.Assembly asm)
 {
     object[] customAttributes = asm.GetCustomAttributes(typeof(ApplicationNameAttribute), true);
     if (customAttributes.Length > 0)
     {
         return ((ApplicationNameAttribute) customAttributes[0]).Value;
     }
     return asm.GetName().Name;
 }
开发者ID:pritesh-mandowara-sp,项目名称:DecompliedDotNetLibraries,代码行数:9,代码来源:ApplicationSpec.cs

示例15: GetName

		///<summary>
		///Name info.
		///</summary>
		/// <param name="assembly">Assembly</param>
		/// <remarks>Unknown name if wrong.</remarks>
		public static string GetName(System.Reflection.Assembly assembly) {
			if (assembly != null) {
				string name = assembly.GetName().Name;
				if (name != null) {
					return name;
				}
			}
			return "Unknown name";
		}
开发者ID:divyang4481,项目名称:lextudio,代码行数:14,代码来源:AssemblyHelper.cs


注:本文中的System.GetName方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。