本文整理汇总了C#中Method类的典型用法代码示例。如果您正苦于以下问题:C# Method类的具体用法?C# Method怎么用?C# Method使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
Method类属于命名空间,在下文中一共展示了Method类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Link
public static void Link(Core.Action action, Method method)
{
action.Method = method;
action.MethodID = method.MethodID;
method.Actions.Add(action);
}
示例2: CardsRequest
public CardsRequest(ICardId card, string resource = "", Method method = Method.GET)
: base("cards/{cardId}/" + resource, method)
{
Guard.NotNull(card, "card");
AddParameter("cardId", card.GetCardId(), ParameterType.UrlSegment);
this.AddCommonCardParameters();
}
示例3: GetRequest
private static RestRequest GetRequest(Method method, string resource)
{
var request = new RestRequest(method);
request.Resource = resource;
request.JsonSerializer = new RestSharpJsonNetSerializer();
return request;
}
示例4: BuildRequest
private RestRequest BuildRequest(string endpoint, Method method,
Dictionary<string, string> urlParams = null,
Dictionary<string, string> inputParams = null,
Dictionary<string, string> headerParams = null)
{
var request = new RestRequest(endpoint, method);
if (urlParams == null) {
urlParams = new Dictionary<string, string>();
}
urlParams.Add("locale", _configService.Locale());
foreach (var entry in urlParams) {
request.AddUrlSegment(entry.Key, entry.Value);
}
if (inputParams != null) {
foreach (var entry in inputParams) {
request.AddParameter(entry.Key, entry.Value);
}
}
if (headerParams != null) {
foreach (var entry in headerParams) {
request.AddHeader(entry.Key, entry.Value);
}
}
return request;
}
示例5: PreVerbExecutionContext
internal PreVerbExecutionContext(
Method method,
object target,
ParameterAndValue[] parameters)
: base(method, target, parameters, new Dictionary<object, object>())
{
}
示例6: VisitCall
/// <summary>
/// Visits the call.
/// </summary>
/// <param name="destination">The destination.</param>
/// <param name="receiver">The receiver.</param>
/// <param name="callee">The callee.</param>
/// <param name="arguments">The arguments.</param>
/// <param name="isVirtualCall">if set to <c>true</c> [is virtual call].</param>
/// <param name="programContext">The program context.</param>
/// <param name="stateBeforeInstruction">The state before instruction.</param>
/// <param name="stateAfterInstruction">The state after instruction.</param>
public override void VisitCall(
Variable destination,
Variable receiver,
Method callee,
ExpressionList arguments,
bool isVirtualCall,
Microsoft.Fugue.IProgramContext programContext,
Microsoft.Fugue.IExecutionState stateBeforeInstruction,
Microsoft.Fugue.IExecutionState stateAfterInstruction)
{
if ((callee.DeclaringType.GetRuntimeType() == typeof(X509ServiceCertificateAuthentication) ||
callee.DeclaringType.GetRuntimeType() == typeof(X509ClientCertificateAuthentication)) &&
(callee.Name.Name.Equals("set_CertificateValidationMode", StringComparison.InvariantCultureIgnoreCase)))
{
IAbstractValue value = stateBeforeInstruction.Lookup((Variable)arguments[0]);
IIntValue intValue = value.IntValue(stateBeforeInstruction);
if (intValue != null)
{
X509CertificateValidationMode mode = (X509CertificateValidationMode)intValue.Value;
if (mode != X509CertificateValidationMode.ChainTrust)
{
Resolution resolution = base.GetResolution(mode.ToString(),
X509CertificateValidationMode.ChainTrust.ToString());
Problem problem = new Problem(resolution, programContext);
base.Problems.Add(problem);
}
}
}
base.VisitCall(destination, receiver, callee, arguments, isVirtualCall, programContext, stateBeforeInstruction, stateAfterInstruction);
}
示例7: CreateRequest
public static IRestRequest CreateRequest(this IRequestFactory factory, Endpoint endpoint, Method method)
{
var request = factory.CreateRequest();
request.Resource = endpoint.Resource;
request.Method = method;
return request;
}
示例8: RestRequest
public RestRequest(string resource, Method method)
{
ContentCollectionMode = ContentCollectionMode.MultiPartForFileParameters;
Method = method;
Resource = resource;
Serializer = new Serializers.JsonSerializer();
}
示例9: GetInstance
/// <summary>
/// This is used to acquire a <c>MethodPart</c> for the method
/// provided. This will synthesize an XML annotation to be used for
/// the method. If the method provided is not a setter or a getter
/// then this will return null, otherwise it will return a part with
/// a synthetic XML annotation. In order to be considered a valid
/// method the Java Bean conventions must be followed by the method.
/// </summary>
/// <param name="method">
/// this is the method to acquire the part for
/// </param>
/// <returns>
/// this is the method part object for the method
/// </returns>
public MethodPart GetInstance(Method method) {
Annotation label = GetAnnotation(method);
if(label != null) {
return GetInstance(method, label);
}
return null;
}
示例10: NewRequest
protected RestRequest NewRequest(string path, Method method)
{
var request = new RestRequest(path, method);
request.AddParameter("no-cache", DateTime.Now.Ticks.ToString(CultureInfo.InvariantCulture), ParameterType.GetOrPost);
return request;
}
示例11: ExecuteGraphApiAsync
internal void ExecuteGraphApiAsync(Method httpMethod, string graphPath, IDictionary<string, string> parameters, bool addAccessToken, Action<FacebookAsyncResult> callback)
{
var request = new RestRequest(graphPath, httpMethod);
if (parameters != null)
{
foreach (var keyValuePair in parameters)
request.AddParameter(keyValuePair.Key, keyValuePair.Value);
}
ExecuteGraphApiAsync(
request,
addAccessToken,
Settings.UserAgent,
response =>
{
Exception exception;
if (response.ResponseStatus == ResponseStatus.Completed)
exception = (FacebookException)response.Content;
else
exception = new FacebookRequestException(response);
if (callback != null)
callback(new FacebookAsyncResult(response.Content, exception));
});
}
示例12: IsMixingMessageContractParams
private bool IsMixingMessageContractParams(Method method)
{
bool hasMessageContract = false;
bool hasOtherType = false;
foreach (Parameter parameter in method.Parameters)
{
if (HasMessageContractAttribute(parameter.Type.Attributes))
{
hasMessageContract = true;
}
else
{
hasOtherType = true;
}
if (hasMessageContract && hasOtherType)
{
return true;
}
}
// check for return type
if (HasMessageContractAttribute(method.ReturnType.Attributes))
{
hasMessageContract = true;
}
else
{
hasOtherType = true;
}
return hasOtherType && hasMessageContract;
}
示例13: CallInfo
public CallInfo(Module vmModule, Method method, int instructionPointer)
{
Module = vmModule;
Class = null;
Method = method;
InstructionPointer = instructionPointer;
}
示例14: Path
public override string Path(Method method = Method.GET)
{
string path = (_parent != null) ? _parent.Path(method) + "/" : "/";
if (_id != null)
path += _id;
return path;
}
示例15: WebServiceRequest
public WebServiceRequest (string resource, Method method)
: base (resource, method)
{
AddHeader("Authorization", "Bearer jh8nCJo5vGRYRji7eT2DzGSn4wkljIJjey8OI9F5iMos0tFezFvwdrcJZtBc3B4EZOPCz" +
"7kcWzWUhqEvYSzY7br7hvXHFxVUnUE6OwdHPUjZojy5MLtWu9UDn1G9QrS6vuIRWtOH3J8mLAtswesmhWD8tHMiVoER9gd8UByg" +
"1wojqpzi3YNa53uPzkwDZkLxjTjgkfKJBAXYtQxNvg7NbLiMf1lCe7LWlQjCNk7VnBYgt4kYlrCLsgVMsRswJP6R");
}