国产av日韩一区二区三区精品,成人性爱视频在线观看,国产,欧美,日韩,一区,www.成色av久久成人,2222eeee成人天堂

目錄
元數(shù)據(jù)的使用
元數(shù)據(jù)類型
元數(shù)據(jù)的作用
元數(shù)據(jù)在 C# 中如何工作?
C# 中的元數(shù)據(jù)示例
示例#3
結論
首頁 后端開發(fā) C#.Net教程 C# 中的元數(shù)據(jù)

C# 中的元數(shù)據(jù)

Sep 03, 2024 pm 03:30 PM
c# c# tutorial

元數(shù)據(jù)中的 C# 被定義為描述我們的程序的二進制信息,該信息要么存儲在公共語言運行時可移植可執(zhí)行文件中,要么存儲在內(nèi)存中。如果您從可移植可執(zhí)行文件編譯代碼,則元數(shù)據(jù)將插入文件的另一個區(qū)域部分,所有這些代碼現(xiàn)在將轉換為 MSIL 格式(Microsoft 中間語言),然后代碼移至文件的另一分區(qū)部分。程序集中定義和引用的所有數(shù)據(jù)類型和數(shù)據(jù)成員都放在元數(shù)據(jù)中。當我們在運行時執(zhí)行 C# 代碼時,它會從內(nèi)存中加載元數(shù)據(jù)。 C#元數(shù)據(jù)的主要目的是了解類的類、數(shù)據(jù)成員、繼承、數(shù)據(jù)類型等信息。文件中的元數(shù)據(jù)由表和堆數(shù)據(jù)結構組成。

元數(shù)據(jù)的使用

以下是元數(shù)據(jù)的用途:

  • 它提供了有關程序集數(shù)據(jù)類型的描述,如名稱、可見性、基類和接口等
  • 它提供了方法、字段、屬性、事件和嵌套類型等數(shù)據(jù)成員。
  • 它還提供了修改類型和成員的元素的附加描述。
  • 它具有名稱、版本、公鑰等身份。
  • 它是簡單編程模型的關鍵,它將消除 IDL(接口定義語言)文件、頭文件的必要性。

元數(shù)據(jù)類型

元數(shù)據(jù)類型如下圖:

C# 中的元數(shù)據(jù)

元數(shù)據(jù)的作用

元數(shù)據(jù)的作用如下:

C# 中的元數(shù)據(jù)

元數(shù)據(jù)在 C# 中如何工作?

C# 元數(shù)據(jù)可以了解有關數(shù)據(jù)的數(shù)據(jù)。

語法:

using packageName;//used for insert the packages in C#
public class MyApp
{
public static int Main()
{
//data types
Console.WriteLine("Required Message");
}
//user defined methods for other logics
}

C# 中的元數(shù)據(jù)示例

下面給出了 C# 中元數(shù)據(jù)的示例:

示例#1

3 個數(shù)字的乘法

代碼:乘法.cs

using System; //Used for declaring the package or used for importing existed packege
public class Multiplication//declaring the class
{
public static int Main ()// main method for displaying the output
{
//declaring and defining the varaiables
int x = 50;
int y = 20;
int z=30;
//Printing the output of the multiplication of 2 numbers
Console.WriteLine ("Multiplication of {0},{1} and {2} is {3}",x,y,z,multiplication(x,y,z));
return 0;
}
public static int multiplication(int x, int y, int z)// multiplication() method implemention
{
return (x * y*z);// return multiplication of 3 numbers
}
}

輸出:

C# 中的元數(shù)據(jù)

說明:

  • 正如您在“關于”中看到的那樣,您可以看到實際數(shù)據(jù),如果我們想要元數(shù)據(jù)或二進制數(shù)據(jù),我們可以在機器生成的代碼中看到編譯器,這些代碼始終是加密的,人類無法理解它。

示例#2

正方形面積

代碼:SquareOfArea.cs

using System; //Used for declaring the package or used for importing existed packege
public class SquareArea//declaring the class
{
public static int Main ()// main method for displaying the output
{
//declaring and defining the varaiables
int x = 50;
//Printing the output of the areaOfSquare
Console.WriteLine ("Area of Square is {0}",areaOfSquare(x));
return 0;
}
public static int areaOfSquare(int x)// multiplication() method implemention
{
return (x*x);// return area Of Square
}
}

輸出:

C# 中的元數(shù)據(jù)

說明:

  • 正如您在“關于”中看到的那樣,您可以看到實際數(shù)據(jù),如果我們想要元數(shù)據(jù)或二進制數(shù)據(jù),我們可以在機器生成的代碼中看到編譯器,這些代碼始終是加密的,人類無法理解它。

示例#3

多個帶有數(shù)據(jù)的類

代碼:MultiData.net

using System; //Used for declaring the package or used for importing existed packege
using System.Collections.Generic; //Used for declaring the package or used for importing existed packege
public class Entity {//declaring the class
//setters and getters for set and get the data
public string Name {get;set;}
public string Uses {get;set;}
//toString method to overide predefined String data
public override string ToString() {
string output1=string.Format("My Name is {0}", Name);
string output2=string.Format(" He is: {0}", Uses);
return output1+output2;
}
}
//declaring interface with reference class extention
public interface IMeta<T> where T: class {
//setters and getter for set and get the data
T Inner {get;set;}
stringMetaData {get;set;}
}
//declaring interface with reference class extention
public interface IStorage<T> where T: class {
//method definition for save the data
T Save();
}
//declaring the class by extending Imeta and IStorage interfaces
public class Meta<T> : IMeta<T>, IStorage<T>
where T: class
{
//creating a generic dictionary variable
private static Dictionary<T, Meta<T>> _stash = new Dictionary<T, Meta<T>>();
//constructor for the class
public Meta(T item) {
Inner = item;
}
//setters and getters for set and get the data
public T Inner {get;set;}
public string MetaData {get;set;}
//method implementation for operator
public static implicit operator T(Meta<T> meta) {
if (! _stash.ContainsKey(meta.Inner))
_stash.Add(meta.Inner, meta);
returnmeta.Inner;
}
public static implicit operator Meta<T>(T item) {
try {
return _stash[item];
} catch {
return null;
}
}
//save the data to repository
public T Save() {
return this;
}
}
//declaring the class
public static class MetaHelper {
//method definition for return the data
public static IMeta<T>GetMeta<T>(T item) where T: class {
return (Meta<T>)item;
}
//method definition for store the data
public static IStorage<T>GetStorage<T>(T item) where T: class {
return (Meta<T>)item;
}
}
//declaring the class
public class Program
{
//Entity type for createEntity method definition with 2 arguments
public static Entity CreateEntity(string name, string uses) {
//creating a variable
var result = new Meta<Entity>(new Entity(){ Name = name, Uses = uses });
//adding data to the variable that is metadata
result.MetaData = "Paramesh";
return? result;
}
//test method to test the data
public static void Main()
{
//Passing the values to createEntity method
varent = CreateEntity("Amardeep", "Good Person");
//types casting ent into Meta class
Meta<Entity> meta = (Meta<Entity>)ent;
//creating variables
varimeta = MetaHelper.GetMeta<Entity>(ent);
varistore = MetaHelper.GetStorage<Entity>(ent);
var stored = istore.Save();
//Displaying output
Console.WriteLine("MetaData: {0} {1} {2} {3}", imeta.MetaData, imeta.Inner.Name, stored.Name, stored.Uses);
Console.WriteLine(ent);
if (meta != null) Console.WriteLine(meta.MetaData);
elseConsole.WriteLine("This is not a meta type");
}
}

輸出:

C# 中的元數(shù)據(jù)

說明:

  • 正如您在“關于”中看到的那樣,您可以看到實際數(shù)據(jù),如果我們想要元數(shù)據(jù)或二進制數(shù)據(jù),我們可以在機器生成的代碼中看到編譯器,這些代碼始終是加密的,人類無法理解它。

結論

C#中的元數(shù)據(jù)用于了解數(shù)據(jù)的相關信息。這些都是加密成二進制格式的,這是人類無法理解的,這就是為什么我們將二進制代碼轉換為正常代碼來分析邏輯。

以上是C# 中的元數(shù)據(jù)的詳細內(nèi)容。更多信息請關注PHP中文網(wǎng)其他相關文章!

本站聲明
本文內(nèi)容由網(wǎng)友自發(fā)貢獻,版權歸原作者所有,本站不承擔相應法律責任。如您發(fā)現(xiàn)有涉嫌抄襲侵權的內(nèi)容,請聯(lián)系admin@php.cn

熱AI工具

Undress AI Tool

Undress AI Tool

免費脫衣服圖片

Undresser.AI Undress

Undresser.AI Undress

人工智能驅動的應用程序,用于創(chuàng)建逼真的裸體照片

AI Clothes Remover

AI Clothes Remover

用于從照片中去除衣服的在線人工智能工具。

Clothoff.io

Clothoff.io

AI脫衣機

Video Face Swap

Video Face Swap

使用我們完全免費的人工智能換臉工具輕松在任何視頻中換臉!

熱工具

記事本++7.3.1

記事本++7.3.1

好用且免費的代碼編輯器

SublimeText3漢化版

SublimeText3漢化版

中文版,非常好用

禪工作室 13.0.1

禪工作室 13.0.1

功能強大的PHP集成開發(fā)環(huán)境

Dreamweaver CS6

Dreamweaver CS6

視覺化網(wǎng)頁開發(fā)工具

SublimeText3 Mac版

SublimeText3 Mac版

神級代碼編輯軟件(SublimeText3)

C# 中的隨機數(shù)生成器 C# 中的隨機數(shù)生成器 Sep 03, 2024 pm 03:34 PM

C# 隨機數(shù)生成器指南。在這里,我們討論隨機數(shù)生成器的工作原理、偽隨機數(shù)和安全數(shù)的概念。

C# 中的階乘 C# 中的階乘 Sep 03, 2024 pm 03:34 PM

C# 階乘指南。這里我們討論 C# 中階乘的介紹以及不同的示例和代碼實現(xiàn)。

c#多線程和異步的區(qū)別 c#多線程和異步的區(qū)別 Apr 03, 2025 pm 02:57 PM

多線程和異步的區(qū)別在于,多線程同時執(zhí)行多個線程,而異步在不阻塞當前線程的情況下執(zhí)行操作。多線程用于計算密集型任務,而異步用于用戶交互操作。多線程的優(yōu)勢是提高計算性能,異步的優(yōu)勢是不阻塞 UI 線程。選擇多線程還是異步取決于任務性質:計算密集型任務使用多線程,與外部資源交互且需要保持 UI 響應的任務使用異步。

C# 中的質數(shù) C# 中的質數(shù) Sep 03, 2024 pm 03:35 PM

C# 素數(shù)指南。這里我們討論c#中素數(shù)的介紹和示例以及代碼實現(xiàn)。

C#與C:歷史,進化和未來前景 C#與C:歷史,進化和未來前景 Apr 19, 2025 am 12:07 AM

C#和C 的歷史與演變各有特色,未來前景也不同。1.C 由BjarneStroustrup在1983年發(fā)明,旨在將面向對象編程引入C語言,其演變歷程包括多次標準化,如C 11引入auto關鍵字和lambda表達式,C 20引入概念和協(xié)程,未來將專注于性能和系統(tǒng)級編程。2.C#由微軟在2000年發(fā)布,結合C 和Java的優(yōu)點,其演變注重簡潔性和生產(chǎn)力,如C#2.0引入泛型,C#5.0引入異步編程,未來將專注于開發(fā)者的生產(chǎn)力和云計算。

C# 中的模式 C# 中的模式 Sep 03, 2024 pm 03:33 PM

C# 模式指南。在這里,我們討論 C# 中模式的介紹和前 3 種類型,以及其示例和代碼實現(xiàn)。

xml怎么改格式 xml怎么改格式 Apr 03, 2025 am 08:42 AM

可以采用多種方法修改 XML 格式:使用文本編輯器(如 Notepad )進行手工編輯;使用在線或桌面 XML 格式化工具(如 XMLbeautifier)進行自動格式化;使用 XML 轉換工具(如 XSLT)定義轉換規(guī)則;或者使用編程語言(如 Python)進行解析和操作。修改時需謹慎,并備份原始文件。

C# 中的回文 C# 中的回文 Sep 03, 2024 pm 03:34 PM

C# 回文指南。在這里,我們討論 C# 中回文背后的介紹和邏輯,以及各種方法及其代碼。

See all articles