本文整理汇总了C#中Code类的典型用法代码示例。如果您正苦于以下问题:C# Code类的具体用法?C# Code怎么用?C# Code使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Code类属于命名空间,在下文中一共展示了Code类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CodeViewModel
public CodeViewModel(Code codeModel)
{
var View = new CodeView();
View.DataContext = this;
foreach (var backProp in codeModel.BackingProperties)
{
FullCode += backProp;
}
FullCode += "/r";
foreach (var backDel in codeModel.BackingDelegates)
{
FullCode += backDel;
}
FullCode += "/r/r";
foreach (var con in codeModel.Constructors)
{
FullCode += con;
}
FullCode += "/r/r #region DelegateMethods/r";
foreach (var delMethod in codeModel.DelegateMethods)
{
FullCode += delMethod;
}
FullCode += "#endregion/r/r#region Properties/r";
foreach (var foreProp in codeModel.ForegroundProperties)
{
FullCode += foreProp;
}
FullCode += "#endregion";
FullCode = FullCode.Replace("/r", Environment.NewLine);
View.Show();
}
示例2: GetLanguageCodeAsString
public static string GetLanguageCodeAsString(Code languageCode)
{
switch (languageCode)
{
case Code.EN:
return "EN";
case Code.FR:
return "FR";
case Code.IT:
return "IT";
case Code.DE:
return "DE";
case Code.ES:
return "ES";
case Code.AR:
return "AR";
case Code.ZHCN:
return "ZH-CN";
case Code.JA:
return "JA";
case Code.KO:
return "KO";
case Code.VI:
return "VI";
case Code.RU:
return "RU";
case Code.NL:
return "NL";
case Code.PT:
return "PT";
}
return "Invalid Language";
}
示例3: Instruction
public Instruction(int offset, Code opcode, object operand, object operand2)
{
this.offset = offset;
this.opcode = opcode;
Operand = operand;
this.operand2 = operand2;
}
示例4: CanBeEqual
public void CanBeEqual()
{
var code1 = new Code("code");
var code2 = new Code("code");
Assert.AreEqual(code1,code2);
}
示例5: power_search_doctor_pageloaddata
public void power_search_doctor_pageloaddata()
{
Code cd = new Code();
DataSet ds = cd.power_search_doctor_pageloaddata();
if (ds != null && ds.Tables[0].Rows.Count > 0)
{
// Health center Names
DropDownList1.DataTextField = ds.Tables[0].Columns["Name"].ToString();
DropDownList1.DataValueField = ds.Tables[0].Columns["ID"].ToString();
DropDownList1.DataSource = ds.Tables[0];
DropDownList1.DataBind();
DropDownList1.Items.Insert(0, "Any");
// Studied at - Country table
DropDownList7.DataTextField = ds.Tables[1].Columns["Name"].ToString();
DropDownList7.DataValueField = ds.Tables[1].Columns["ID"].ToString();
DropDownList7.DataSource = ds.Tables[1];
DropDownList7.DataBind();
DropDownList7.Items.Insert(0, "Any");
// Worked at - Country table
DropDownList2.DataTextField = ds.Tables[1].Columns["Name"].ToString();
DropDownList2.DataValueField = ds.Tables[1].Columns["ID"].ToString();
DropDownList2.DataSource = ds.Tables[1];
DropDownList2.DataBind();
DropDownList2.Items.Insert(0, "Any");
// Specialist - Specifications table
DropDownList4.DataTextField = ds.Tables[2].Columns["Name"].ToString();
DropDownList4.DataValueField = ds.Tables[2].Columns["ID"].ToString();
DropDownList4.DataSource = ds.Tables[2];
DropDownList4.DataBind();
DropDownList4.Items.Insert(0, "Any");
}
}
示例6: GetSingleField
static FieldDefinition GetSingleField(PropertyDefinition property, Code code, MethodDefinition methodDefinition)
{
if (methodDefinition?.Body == null)
{
return null;
}
FieldReference fieldReference = null;
foreach (var instruction in methodDefinition.Body.Instructions)
{
if (instruction.OpCode.Code == code)
{
//if fieldReference is not null then we are at the second one
if (fieldReference != null)
{
return null;
}
var field = instruction.Operand as FieldReference;
if (field != null)
{
if (field.DeclaringType != property.DeclaringType)
{
continue;
}
if (field.FieldType != property.PropertyType)
{
continue;
}
fieldReference = field;
}
}
}
return fieldReference?.Resolve();
}
示例7: getInitializedArray
public static Value[] getInitializedArray(int arraySize, MethodDefinition method, ref int newarrIndex, Code stelemOpCode)
{
var resultValueArray = new Value[arraySize];
var emulator = new InstructionEmulator(method.HasThis, false, method.Parameters, method.Body.Variables);
var theArray = new UnknownValue();
emulator.push(theArray);
var instructions = method.Body.Instructions;
int i;
for (i = newarrIndex + 1; i < instructions.Count; i++) {
var instr = instructions[i];
if (instr.OpCode.FlowControl != FlowControl.Next)
break;
if (instr.OpCode.Code == Code.Newarr)
break;
if (instr.OpCode.Code == stelemOpCode) {
var value = emulator.pop();
var index = emulator.pop() as Int32Value;
var array = emulator.pop();
if (ReferenceEquals(array, theArray) && index != null && index.allBitsValid()) {
if (0 <= index.value && index.value < resultValueArray.Length)
resultValueArray[index.value] = value;
}
}
else
emulator.emulate(instr);
}
if (i != newarrIndex + 1)
i--;
newarrIndex = i;
return resultValueArray;
}
示例8: Is_Ldarg_C
private static Boolean Is_Ldarg_C(VirtualOpCode ins, Code code)
{
// Ldarg_C delegates will reference the arguments field in their Ldfld, which sets them apart from
// other very similar delegates
return ins.Matches(ins.ModifyPattern(Pattern_Ldarg_C, Code.Ldc_I4, code))
&& ((FieldDef)ins.DelegateMethod.Body.Instructions[2].Operand).MDToken == ins.VType.ArgumentsField.MDToken;
}
示例9: feedControl_FeedbackReceived
async void feedControl_FeedbackReceived(Code.FeedbackObject feedbackObj)
{
ShowProgressBar(true);
// send the feedback to the server from here
var feedbackResult = await MyILPClient.RegisterFacultyFeedback(currentSelectedSchedule, feedbackObj);
string title = "Information";
string content = "";
switch (feedbackResult.FeedStatus)
{
case FeedbackResult.FeedbackStatusType.NEW:
content = "Thank you giving your valuable feedback!";
break;
case FeedbackResult.FeedbackStatusType.OLD:
content = "Feedback has already been given for the selected slot";
break;
case FeedbackResult.FeedbackStatusType.ERROR:
title = "Error";
content = "Some error has occured while trying to send feedback. Please try again later.";
break;
}
MessageDialog md = new MessageDialog(content, title);
await md.ShowAsync();
#if DEBUG
System.Diagnostics.Debug.WriteLine("Feedback result: " + feedbackResult.FeedStatus);
#endif
ShowProgressBar(false);
}
示例10: TestCanAddAFunctionStrCode
public void TestCanAddAFunctionStrCode()
{
const string name = "faddsc";
var func = new Code("function(x, y){return x + y;}");
_javascript.Add(name, func);
Assert.IsNotNull(_javascript[name]);
}
示例11: LoadUI
private void LoadUI(Code.Playlist.Playlist playlist)
{
this.StackMedia.Children.Clear();
if (playlist != null)
{
this.UITitle.Text = playlist.Name;
List<MediaEvent> Medias = playlist.LoadMediaEvent();
if (Medias != null)
{
foreach (MediaEvent e in Medias)
{
UIMediaEvent UIE = new UIMediaEvent();
UIE.Height = 50;
UIE.Width = 395;
UIE.Event = e;
UIE.DeleteEvent += UIE_DeleteEvent;
UIE.ViewMediaEvent += UIE_ViewMediaEvent;
this.StackMedia.Children.Add(UIE);
}
}
}
else
{
this.UITitle.Text = string.Empty;
}
}
示例12: Convert
public void Convert(string inputFileName, string outputFileName)
{
VersionableBase.DefaultAgencyId = "example.org";
if (string.IsNullOrWhiteSpace(inputFileName))
{
throw new ArgumentNullException("inputFileName");
}
if (string.IsNullOrWhiteSpace(outputFileName))
{
throw new ArgumentNullException("outputFileName");
}
InitializeDdiElements();
// Go through each row of the spreadsheet.
DataTable iscoTable = GetSpreadsheetContents(inputFileName);
foreach (DataRow row in iscoTable.Rows)
{
// Create a category and map information from each column.
Category category = new Category();
category.Label["en"] = row["description EN"].ToString();
category.Label["fr"] = row["description FR"].ToString();
category.Label["de"] = row["description DE"].ToString();
category.Description["en"] = row["texte auto EN"].ToString();
category.Description["fr"] = row["texte auto FR"].ToString();
category.Description["de"] = row["texte auto DE"].ToString();
categoryScheme.Categories.Add(category);
// Create a code.
Code code = new Code();
code.Category = category;
code.Value = row["code"].ToString();
// First level codes are added directly the CodeScheme.
int level = code.Value.Length;
if (level == 1)
{
codeScheme.Codes.Add(code);
}
else
{
// For child codes, look up the parent code.
// The parent's value will be the same as this new code's value,
// minus the last character.
var flatCodes = codeScheme.GetFlattenedCodes();
Code parent = flatCodes.SingleOrDefault(c => c.Value == code.Value.Substring(0, code.Value.Length - 1));
parent.ChildCodes.Add(code);
}
Console.WriteLine(string.Format("{0} {1}", code.Value, category.Label["en"]));
}
// Save the DDI XML.
DDIWorkflowSerializer serializer = new DDIWorkflowSerializer();
serializer.UseConciseBoundedDescription = false;
XmlDocument doc = serializer.Serialize(this.instance);
DDIWorkflowSerializer.SaveXml(outputFileName, doc);
}
示例13: Field
public Code Field(Code baseExpr, String name) {
Type scope = (baseExpr == null) ? cls : ((Node)baseExpr).Type;
FieldInfo f = QueryImpl.lookupField(scope, name);
if (f == null) {
throw new CodeGeneratorException("No such field " + name + " in class " + scope);
}
return new LoadNode((Node)baseExpr, f);
}
示例14: TestCanAddFunctionByAssignment
public void TestCanAddFunctionByAssignment()
{
const string name = "fassignadd";
var func = new Code("function(x,y){return x + y;}");
var doc = new Document().Add("_id", name).Add("value", func);
_javascript[name] = doc;
Assert.IsNotNull(_javascript[name]);
}
示例15: CodeRunner
public CodeRunner(IDebugger debugger, string source)
{
_debugger = debugger;
_source = source;
Context = new Context(new Scope());
CodeGenerator = new Code();
}